Builder for projects based on ym modules. Built on top of gulp task runner.
npm install ymbymb
======
Builder for projects based on ym modules. Built on top of gulp@^4 task runner.
Requirements
------------
ymb works with Node.js 0.10+.
Getting Started
---------------
CLI usage
You can install ymb globally using Node Package Manager (npm):
npm install --save-dev ymb
Then you can use node_modules/.bin/ymb 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.
``bashbuild.json
node_modules/.bin/ymb configure [DIR=.] [build.json] [gulpfile.js] [-f] # Makes a copy of default and/or gulpfile.js in specified directory.dev
node_modules/.bin/ymb dev [DIR=.] [-m that will rebuild project on any change of source files specified in build.json.build
node_modules/.bin/ymb [build] [DIR=.] [-m described by local or default gulpfile.js.`
Explaining build.json
build.json contains build settings. You can copy the default one into your project dir with ymb configure . and then override it.
`javascriptstore
{
// 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 the output JavaScript file when set to solid.
"concatTo": "all.js",
// Output files optimization.
"minify": true,
// And you can use object to set minify options. See more https://www.npmjs.com/package/gulp-uglify#options
// "minify": {
// "extension": "js" // Extension of target files
// }
// Set to false to prevent inline data URI for images in CSS. Add #no-datauri to image path to prevent for particular file.build/{publicDir}/images
// You will need to route static handler for on server side.
"dataUriImages": true,
"publicDir": "public",
// If you want to make a plugin for existing project providing ym modular system (i.e. Yandex Maps API),target
// set option to plugin. Option namespace should contain name of the main project global namespace.ym
//
// Otherwise you can run your project as standalone.
// Then builder will inject modular system and helper modules into build output.namespace
// In this case option specifies the variable name to be exported into the global scope,modules
// that will contain property referencing the modular system.
"target": "plugin",
"namespace": "ym",
// Defines how to store your build data: solid for single file and async for running with yms.yms
// More information about and examples of async projects is here: https://www.npmjs.org/package/yms
"store": "solid",
// You can specify array of modules to be preloaded along with ones specified in GET params and ready method.
"preload": [],
// You can insert another async layer, when information about certain modules ("modules map") is not included into init.js,yms
// but can be loaded with another HTTP request to server. These features are experimental and may cause issues.
"asyncMap": false,
"initialMap": null,
// You can use different modes overriding global options, but don't forget to specify one of them when running builder.
// "modes": {
// "debug": {
// "default": true,
// "minify": false
// }
// }
}
`
Explaining gulpfile.js
If you want more flexibility you can also override default gulpfile.js by cloning it locally with ymb 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.
Check out ymb plugins documentation.
`javascript
var gulp = require('gulp'),
ymbPlugins = require('ymb').plugins;
gulp.task('templates', function () {
gulp.src(/ .. /)
.pipe(/ .. /)
.pipe(ymbPlugins.templates.compile())
.pipe(/ .. /);
});
``