ym-builder v0.1.1
ym-builder 0.1
Builder for projects based on ym modules. Built on top of gulp task runner.
Requirements
ym-builder works with Node.js ^0.10.
Getting Started
####CLI usage:####
You can install ym-builder
globally using Node Package Manager (npm):
npm install -g ym-builder
Then you can use ym-builder
console command to build your project, create configuration files or setup auto-build task (watch) for any file changes.
Builder will then try to find your build.json
and gulpfile.js
configuration files or use default ones.
ym-builder [build] [DIR=.] # Runs gulp task "ym-build" described by local or default gulpfile.js.
ym-builder watch [DIR=.] # Setups gulp task "ym-watch" that will run "ym-build" on any change of source files specified in build.json.
ym-builder configure [DIR=.] [build.json] [gulpfile.js] [-f] # Makes a copy of default build.json and/or gulpfile.js in specified directory.
ym-builder help # Displays this message.
####Explaining build.json:####
build.json
contains build settings. You can copy the default one into your project dir with ym-builder configure .
and then override it.
{
// Globs for files to be processed. Related to project dir.
"src": {
"js": "src/**/*.js",
"css": "src/**/*.css",
"templates": "src/**/*.ymtpl"
},
// Path that build results will be placed into. Related to project dir.
"dest": "build/",
// Name of main output JS file.
"concatTo": "all.js",
// Output files optimization.
"minify": true,
// If you want to make a plugin for existing project providing `ym` modular system (i.e. `Yandex Maps API`),
// you should specify where to find it in the client code (JavaScript variable having `modules` property).
"environment": "ymaps",
// Alternative for previous:
// If you want to run your project as standalone,
// builder will inject `ym` modular system and helper modules source code into your main output file.
// This option specifies the variable name of the object to be exported into the `global` scope,
// that will contain `modules` property referencing the modular system.
"standalone": false
}
####Explaining gulpfile.js:####
If you want more flexibility you can also override default gulpfile.js
by cloning it locally with ym-builder configure . gulpfile.js
. Read more about gulpfiles on gulp project page.
####Plugins usage:####
If you're already using gulp
and have your own gulpfile.js
you can require our plugins directly and use them in your tasks.
var gulp = require('gulp'),
ymbPlugins = require('ym-builder').plugins;
gulp.task('templates', function () {
gulp.src(/* .. */)
.pipe(/* .. */);
.pipe(ymbPlugins.templates.compile());
.pipe(/* .. */);
});