evo/sass

leafo\scss 的 CLI 包装器

dev-master 2019-04-14 06:24 UTC

This package is auto-updated.

Last update: 2024-09-14 19:04:15 UTC


README

leafo\scssphp 编译器的命令行包装器

关于该文档的更多信息,请访问以下链接

https://github.com/leafo/scssphp

该项目还使用了我的一些其他项目作为依赖,主要是我的 CLI 库

https://github.com/ArtisticPhoenix/Cli

参数

术语

  • 长名称 在 CLI 中使用长名称时,应该以 --(双横线)开头,例如 php /pathto/SCSS --help。对于 HTTP 请求,只需将长名称或短名称作为请求数据的一部分即可。例如 www.localhost/SCSS?help
  • 短名称 在 CLI 中使用短名称时,应该以 -(单横线)开头,例如 php /pathto/SCSS -h。对于 HTTP 请求,只需将长名称或短名称作为请求数据的一部分即可。例如 www.localhost/SCSS?h
  • 必需 这些参数必须在 --config 文件中或作为请求的一部分存在。
  • 必需值 如果存在这些参数,则它们必须具有值。它们并非必需使应用程序运行,但如果包含它们,则必须包含值。

我可以提供的最佳示例之一是使用帮助参数。

#via HTTP get (short name)
https:///SCSS/?h
https:///SCSS/?help

#via Command line
php /home/app/SCSS/index.php -h
php /home/app/SCSS/index.php --help

在这种情况下,您的输出应该类似于以下内容

Usage: php  [--] [args...]
    -h, --help           Show this help document
    -b, --bootstrap      SCSS Bootstraper file (should include @imports)
    -d, --debug          Annotate selectors with CSS referring to the source file and line number
    -f, --format         Set the output format (compact, compressed, crunched, expanded, or nested)
    -c, --config         Config file
    -i, --import         Set import path, multiple paths can be set with a comma seperated list
    -l, --linenumber     Annotate selectors with comments referring to the source file and line number
    -n, --nocache        Bypass caching
    -m, --mapsource      Create source map file
    -o, --output         File to output to
    -p, --precision      Set decimal number precision (default 10)
    -s, --skip           Continue compilation (as best as possible) when error encountered
    -a, --cache          Cache file path, filenames are ignored (defult the current dir)
    -t, --tree           Dump formatted parse tree
    -v, --version        Print the version

安装

您可以通过 composer 获取它,通过要求它。

"require" : {
    "evo/cli" : "~1.0"
}

它有一些依赖项(这些依赖项包含在 composer.json 文件中)。

"require" : {
	"php" : ">=5.6",
	"evo/patterns" : "~1.0",
	"evo/exception" : "dev-master",
	"leafo/scssphp" : "~0.7",
	"evo/cli" : "~1.0"
}

虽然它并不是真正用于通过浏览器使用,但如果您真的想这样做,您也可以这样做。通常,您不会将此库包含在您的项目中。相反,您应该在项目外部安装它。然后,在您的项目中添加一个类似以下内容的配置文件

if(!defined('ARTISTICPHOENIX_DIR')) define('ARTISTICPHOENIX_DIR', str_replace('\\','/', realpath(__DIR__.'/../..')));
return array(
    'output'        => ARTISTICPHOENIX_DIR.'/css/style-override.css',
    'import'        => ARTISTICPHOENIX_DIR.'/scss',
    'cache'         => __DIR__,
    'format'        => 'expanded',//compact|compressed|crunched|expanded|nested
    'bootstrap'     => 'bootstrap', 
);

所有这些设置也可以通过 CLI、GET 或甚至 POST 直接通过参数发送。