unicompile v2.3.1
Description
A tool primarily created for Drupal themes and modules to compile SASS and ES5+ Javascript into ES5 based on a configuration file.
Paths to projects can be defined, then every js/**/*.js and scss/**/*.scss file is compiled into a dist/css or dist/js folder by default, or a folder of your choice if you provde an argument.
Installation
Local install:
npm install unicompileLocal dev install:
npm install -D unicompileGlobal install:
npm install -g unicompileUsage
unicompile build [options] [source] [output]- (optional) To initialize the config file run
node node_modules/.bin/unicompile init(orunicompile initif you installed globally) - If installed locally run
node node_modules/.bin/unicompile -hto see available commands. - If installed globally run
unicompile -hto see available commands.
IMPORTANT
As this package is utilizing Babel it is heavily advised to include a .babelrc or a babel.config.json file in your project.
See Babel Config Files documentation for further information.
Configuration options for the config file:
cwd
- Type:
String - Default:
undefined
A mandatory option for defining the project folder. This path can be either relative or absolute. Be mindful that this shouldn't include the glob pattern.
Example:
In .unicompilerc.json:
[
{
"cwd": "/home/johndoe/projects/project1"
},
{
"cwd": "/home/johndoe/projects/project2"
}
]out
- Type:
String - Default:
undefined
An optional path for the output folder. If this option is not given, "${cwd}/dist" is used as a default output path.
Example:
In .unicompilerc.json:
[
{
"cwd": "/home/johndoe/projects/project1/src",
"out": "/home/johndoe/projects/project1/build"
},
{
"cwd": "/home/johndoe/projects/project2/src",
"out": "/home/johndoe/projects/project2/build"
}
]sassIgnore (optional)
- Type:
Array<String> - Default:
[]
An array of glob patterns to ignore. See Glob Primer for further information.
Example:
In .unicompilerc.json:
[
{
"cwd": "/home/johndoe/projects/project1",
"sassIgnore": ["**/vendor/**"]
}
]jsIgnore (optional)
- Type:
Array<String> - Default: undefined
An array of glob patterns to ignore. node_modules folder is excluded by default. See Glob Primer for further information.
Example:
In .unicompilerc.json:
[
{
"cwd": "/home/johndoe/projects/project1",
"jsIgnore": ["**/vendor/**"]
}
]