Skip to content

mnmly/builder-myth

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

builder-myth

myth plugin for component-builder2.

Installation

$ npm install mnmly/builder-myth
# or 
$ npm install builder-myth

API

  • myth(options)

Currently options can take only whitespace boolean.

It takes same option that can be passed to as rework's toString(opts). On top of it, you can also pass whitespace, if you want to use significant whitespace.

Usage

var Builder = require('component-builder2');
var Resolver = require('component-resolver');
var co = require('co');
var myth = require('builder-myth');

co(function* build() {
    var resolver = new Resolver(process.cwd(), {
        install: true
    });

    // resolve the dependency tree
    var tree = yield* resolver.tree();
    // lists the components in the proper build order
    var nodes = resolver.flatten(tree);

    // only include `.js` files from components' `.scripts` field
    var script = new Builder.scripts(nodes);
    script.use('scripts', Builder.plugins.js());

    // only include `.css` files from components' `.styles` field
    var style = new Builder.styles(nodes);
    style.use('styles', Builder.plugins.css());
    style.use('styles', myth());

    // Or with whitespace option
    // style.use('styles', myth({whitespace: true, compress: true, sourcemap: true}));

    // write the builds to the following files in parallel
    yield [
        script.toFile('build.js'),
        style.toFile('build.css')
    ];
})();

License

MIT

About

myth plugin for builder2

Resources

Stars

Watchers

Forks

Packages

No packages published