gulp-ng-classify

Convert CoffeeScript classes to AngularJS modules with ng-classify

Module License: MIT

Added by: Sam Deering

GitHub

Repository

carylandholt/gulp-ng-classify

Stats

Stars: 10

Watchers: 10

Forks: 2

Module Description

gulp-ng-classify

License Version Build Status Dependency Status

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

Module stats last updated: 2015-06-04 11:08:57

Disclaimer: Some data on this page may have been gathered from the authors GitHub respository. If you see any mistakes or outdated information please let us know. Thanks!