sails-generate-gulp-bower

0.2.2 • Public • Published

Sails Generator for Gulp and Bower Support

This module provides a Sails.js generator. It provides configuration for the gulp.js build system and integrates it with the Bower package manager.

Install

Simply run

npm install sails-generate-gulp-bower

You should have sails installed globally, so now you can run

sails generate gulp-bower

inside of a sails project's folder. After this, you should execute

npm install
bower install

to install all new dependencies.

node-canvas

As our sprite module depends on node-canvas you will have to install some additional dependencies (if not already existing). Instructions for installing can be found here.

Usage

The gulp configuration provides several useful tasks, which are listed below. You can find configuration options and a more detailed description in the gulp folder.

build

Compiles all available and required files into the smallest amount of bundles possible and links them into all views.

This includes the following scripts:

  • Standard scripts
  • Scripts from bower packages
  • Compiled handlebars templates
  • Any specified modules

And the following styles:

  • Standard styles
  • Styles from bower packages
  • A stylesheet generated from images (includes sprite as base64 encoded image)

In addition, any specified assets are copied to the target folder as well.

watch

Does the same as the build task, except for compiling into single files. Instead it updates blazingly fast on any file changes.

lint

Runs jshint and csslint over all corresponding files in your project folder. Excludes anything in your .gitignore file.

clean

Removes all files created by gulp.

Considerations when switching from Grunt

Several things should be considered when you first start using the provided gulp tasks.

View Handling

As I do not consider it good style, to commit the automatically inserted scripts and styles to git each time gulp updates them, views are now stored in views-in. After injection is done, the views are written to the views folder, so you should exclude this folder from git.

In addition the injection comments have changed and are now:

<!-- //CSS// --><!-- \\CSS\\ -->
<!-- //JS// --><!-- \\JS\\ -->

Sails lift

Sails lift does not start grunt anymore, but it does not start gulp either. As far as I could see from the sails source, grunt integration was more of a hack, spawning grunt via forever in a child process. If this is wrong or anyone writes a good hook for gulp integration, let me know and I will include it. But for now, you will have to run gulp watch in a second terminal.

Bower Location

By default, your bower packages will be put into assets/components. You may wish to exlude this folder from your .gitignore.

Package Sidebar

Install

npm i sails-generate-gulp-bower

Weekly Downloads

1

Version

0.2.2

License

MIT

Last publish

Collaborators

  • paulavery