1.0.2 • Published 10 years ago
simple-preprocess v1.0.2
Preprocess html, js and css based off environment configuration
Originally based on preprocess. Created this because I only want to do simpler things with simpler config.
Install
$ npm install --save simple-preprocess
Usage
var simplePreprocess = require('simple-preprocess');
simplePreprocess('/* @if dev */\nbody {\nbackground: red;\n}\n/* @endif */\n/* @if test*/\n/*body {\nbackground: yellow;\n}*/\n/* @endif*/', 'css', 'dev');
/*=> {
data: 'body {\nbackground: red;\n}\n',
retained: ['/* @if dev *\/\nbody {\nbackground: red;\n}\n/* @endif *\/\n'],
stripped: ['/* @if test*\/\n/*body {\nbackground: yellow;\n}*\/\n/* @endif*\/']
} */
$ npm install --global simple-preprocess
$ simple-preprocess --help
Usage
simple-preprocess <input-path> <type>
simple-preprocess <input-path> <type> <output-path>
cat <input-path> | simple-preprocess <type>
Example
simple-preprocess env.css css -c 'prod,dev'
simple-preprocess env.html html env.html
cat env.css | simple-preprocess css -c test
cat env.js | simple-preprocess js -c dev > processed.js
Options
-e, --env Environment
-v, --verbose Verbose output
API
simplePreprocess(data, type, env)
data
Type string
type
Type string
Posible values: 'html'
, 'js'
and 'css'
env
Type string
or array
Default: process.env.NODE_ENV
License
MIT © Steve Mao