You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
54 lines
1.2 KiB
54 lines
1.2 KiB
gulp = require 'gulp'
|
|
del = require 'del'
|
|
coffee = require 'gulp-coffee'
|
|
coffeelint = require 'gulp-coffeelint'
|
|
header = require 'gulp-header'
|
|
uglify = require 'gulp-uglify'
|
|
rename = require 'gulp-rename'
|
|
pjson = require './package.json'
|
|
copyright = """
|
|
/*!
|
|
Non-Sucking Autogrow #{pjson.version}
|
|
license: #{pjson.license}
|
|
author: Roman Pushkin
|
|
#{pjson.homepage}
|
|
*/
|
|
|
|
"""
|
|
|
|
dest = 'dist/'
|
|
source = 'src/'
|
|
code =
|
|
in: "#{source}*.coffee"
|
|
out: "#{dest}"
|
|
|
|
gulp.task 'clean', ->
|
|
del [dest + '*']
|
|
|
|
gulp.task 'build', ->
|
|
gulp
|
|
.src code.in
|
|
.pipe coffeelint()
|
|
.pipe coffeelint.reporter() # Show coffeelint errors
|
|
.pipe coffeelint.reporter('fail') # Make sure it fails in case of error
|
|
.pipe coffee()
|
|
.pipe header copyright
|
|
.pipe gulp.dest(code.out)
|
|
|
|
gulp
|
|
.src code.in
|
|
.pipe coffeelint()
|
|
.pipe coffeelint.reporter() # Show coffeelint errors
|
|
.pipe coffeelint.reporter('fail') # Make sure it fails in case of error
|
|
.pipe coffee()
|
|
.pipe uglify()
|
|
.pipe rename({ suffix: '.min' })
|
|
.pipe header copyright
|
|
.pipe gulp.dest(code.out)
|
|
|
|
gulp.task 'watch', ->
|
|
gulp
|
|
.watch code.in, ['build']
|
|
|
|
gulp.task 'default', ['clean', 'build', 'watch'], ->
|
|
|
|
|