This repository has been archived by the owner on Jan 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 156
/
gulpfile.coffee
82 lines (70 loc) · 2.03 KB
/
gulpfile.coffee
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
gulp = require 'gulp'
coffee = require 'gulp-coffee'
gutil = require 'gulp-util'
sass = require 'gulp-ruby-sass'
concat = require 'gulp-concat'
mocha = require 'gulp-mocha'
preprocess = require 'gulp-preprocess'
uglify = require('gulp-uglify')
cssmin = require('gulp-cssmin')
rename = require('gulp-rename')
rimraf = require('gulp-rimraf')
fs = require 'fs'
gulp.task 'default', ['mocha']
gulp.task 'clean', ->
gulp.src('dist', { read: false })
.pipe(rimraf())
gulp.task 'mocha', ->
gulp.src(['test/*.coffee'], { read: false })
.pipe(mocha(ui: 'tdd'))
.on('error', gutil.log)
gulp.task 'dist', ['clean'], ->
gulp.src(['src/jquery.jsonview.coffee'])
.pipe(preprocess())
.pipe(coffee(bare: true))
.pipe(gulp.dest('dist'))
gulp.src(['src/jquery.jsonview.coffee'])
.pipe(preprocess())
.pipe(coffee(bare: true))
.pipe(uglify())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('dist'))
gulp.src('src/*.scss')
.pipe(sass())
.pipe(gulp.dest('dist'))
gulp.src('src/*.scss')
.pipe(sass())
.pipe(cssmin())
.pipe(rename({suffix: '.min'}))
.pipe(gulp.dest('dist'))
gulp.src('src/index.html')
.pipe(preprocess(context: { dist: true }))
.pipe(gulp.dest('dist'))
gulp.task 'watch', ->
gulp.watch(['src/**/*', 'test/**/*'], ['dist', 'mocha'])
gulp.task 'package', ->
data = fs.readFileSync 'package.json', 'utf8'
pkg = JSON.parse(data)
# jquery.json
json1 =
name: pkg.name,
description: pkg.description,
version: pkg.version,
author: pkg.author,
keywords: pkg.keywords,
homepage: pkg.homepage
json2 = pkg.jqueryJSON
json1[key] = json2[key] for key of json2
fs.writeFile 'jsonview.jquery.json', JSON.stringify(json1, null, 2)
# bower.json
json1 =
name: pkg.name,
description: pkg.description,
version: pkg.version,
main: pkg.main
keywords: pkg.keywords,
license: pkg.license,
homepage: pkg.homepage
json2 = pkg.bowerJSON
json1[key] = json2[key] for key of json2
fs.writeFile 'bower.json', JSON.stringify(json1, null, 2)