Awesome
gulp-ng-classify
Convert CoffeeScript classes to AngularJS modules with ng-classify
Write less JavaScript. Write less CoffeeScript. Write less Angular.Watch the screencast
Install
Install with npm
$ npm install gulp-ng-classify
Usage
CoffeeScript
gulp = require 'gulp'
ngClassify = require 'gulp-ng-classify'
gulp.task 'default', ->
gulp.src '**/*.coffee'
.pipe ngClassify()
.pipe gulp.dest 'dist'
JavaScript
var gulp = require('gulp');
var ngClassify = require('gulp-ng-classify');
gulp.task('default', function () {
return gulp.src('**/*.coffee')
.pipe(ngClassify())
.pipe(gulp.dest('dist'));
});
Table of Contents
API
See the ng-classify docs
ngClassify(options)
options
Optional
Type: Object
(see ng-classify API) or Function
(see examples below)
Default: undefined
Dynamically create options via the function callback. The function takes in the file object and returns the options.
gulp = require 'gulp'
ngClassify = require 'gulp-ng-classify'
gulp.task 'default', ->
gulp.src '**/*.coffee'
.pipe ngClassify (file) ->
# use 'admin' as the appName if 'administrator' is found in the file path
return if file.path.indexOf('administrator') isnt -1
{appName: 'admin'}
{appName: 'app'}
.pipe gulp.dest 'dist'
var gulp = require('gulp');
var ngClassify = require('gulp-ng-classify');
gulp.task('default', function () {
return gulp.src('**/*.coffee')
.pipe(ngClassify(function (file) {
// use 'admin' as the appName if 'administrator' is found in the file path
if (file.path.indexOf('administrator') !== -1) {
return {appName: 'admin'};
}
return {appName: 'app'};
}))
.pipe(gulp.dest('dist'));
});
Contributing
See CONTRIBUTING.md
Changelog
See CHANGELOG.md
License
See LICENSE