YACP
Yet Another CSS Preprocessor.
Installation
$ npm install -g yacp
when use in HTML:
$ bower install client-yacp
Example
/* Import your other CSS files */;} /* Placeholder selector for `extend` */%
Compiled with the following command:
$ yacp input.css output.css
Yields:
/* Expand foo.css */ /* Inherited in `.attBox` */
Features
- Automatic vendor-prefixed property
- Rulesets binding syntax
- Inherit other rules more safely
- W3C-style CSS variables syntax
- Support
calc()
, a feature to do simple calculations - Read and inline css via
@import
Bind ruleset syntax
YACP provide Bind ruleset syntax.
Selectors rounded by ()
cannot cascade.
Using this feature, you can define encapsulated ruleset.
() /* Error *//* Error */()
Inherit other rulesets safely
One of fault of existin CSS Preprocessor is compiling any code which don't have syntax error.
This is 'dangerous' inheritance code (Sass):
Yields:
When overwrite .btn
, .btn-success
is overwrote too, and it may cause unexpected result.
But, YACP's inheritance is safe. You can use with extend(s)
or inherit(s)
property.
-
Must use the placeholder selector (
%
). The Ruleset defined with placeholder selector don't output as CSS code. -
YACP's placeholder selector cannot cascade.
-
If inherited selectors have same properties, run error.
Ex (1, 2):
% /* Error */%
Ex (3):
% %
Using this feature, you can define private (cannot overwrite and refer from only YACP code) ruleset.
Compile Options
$ yacp --help
Usage: yacp [options]
Options:
-c, --compress use output compression
-s, --strict use strict mode compile
-w, --whitespace use whitespace syntax like Stylus
-V, --versions output the version number
-h, --help output usage information
strict mode
YACP's strict mode allow only class and pseudo-elements selector.
Following selectors cannot compile.
Ex:
and prohibit !important
.
Using this option, you can keep specificity constant, so its code will be more maintenable.
whitespace mode
Using with css-whitespace.
Option projects
License
The MIT License (MIT)
Copyright (c) 2014 Masaaki Morishita