1.1.1 • Published 9 years ago

brick-asset v1.1.1

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

Asset Generator for Brick.JS

NPM version Build Status Coverage Status Dependency manager

This article explains how to use brick-asset as a command line tool (and as a NPM package). For information about CSS Processors called by brick-asset, see:

  • brick-js/brick-less: LESS pre-processor for brick.js.
  • brick-sass? All kind of contributions are wellcomed.

Command Line Interface

Install

npm install -g brick-asset

Usage

Generate "./public/site.js" and "./public/site.css":

brick-asset all

Only generate ./public/site.css:

brick-asset css

Specify Brick.JS Module Root (default to ./bricks/):

brick-asset all --root ./my-brick-modules

Specify output location:

# ./static/site.js, ./static/site.css
brick-asset all --output ./static

# ./static/js/main.js
brick-asset js --output ./static/js/main.js

For more details, see:

brick-asset --help

Programmatically

Usage

var asset = require('brick-asset');
var promise = asset.src('./bricks');
promise
  .then(function(){
    asset.js().then(src => console.log(src));
    asset.css().then(src => console.log(src));
  });

.src()

.src() load bricks in the specified directory.

Returns a promise which will be resolved as brick Array.

.js()

.js() generates the JS for all the bricks with a CommonJS loader.

Returns a promise which will be resolved as a String of JavaScript source.

.css()

.css() generates the modularized CSS for all the bricks.

Returns a promise which will be resolved as a String of CSS source.

Gulp Task

Here's a Gulp file generating public/site.css and public/site.js:

var asset = require('brick-asset');
var file = require('gulp-file');

gulp.task('js', function(cb) {
    asset.src('./bricks')
        .then(x => asset.js())
        .then(css => file('site.js', css, {src: true})
            .pipe(gulp.dest('public'))
            .on('finish', cb));
});

gulp.task('css', function(cb) {
    asset.src('./bricks')
        .then(x => asset.css())
        .then(css => file('site.css', css, {src: true})
            .pipe(gulp.dest('public'))
            .on('finish', cb));
});
1.1.1

9 years ago

1.1.0

10 years ago

1.0.9

10 years ago

1.0.8

10 years ago

1.0.7

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago