Gruntfile.js
3.6 KB
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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
module.exports = function(grunt) {
// These are the files used in order to build the Jcrop.js source
// variable is used in initConfig concat rule below
// also used for the watch task
var jcrop_sources = [
'src/intro.js',
'src/constructor.js',
'src/static.js',
'src/stage/Abstract.js',
'src/stage/Image.js',
//'src/stage/CssTransform.js',
'src/stage/Canvas.js',
'src/filter/BackoffFilter.js',
'src/filter/ConstrainFilter.js',
'src/filter/ExtentFilter.js',
'src/filter/GridFilter.js',
'src/filter/RatioFilter.js',
'src/filter/RoundFilter.js',
'src/filter/ShadeFilter.js',
'src/component/CanvasAnimator.js',
'src/component/CropAnimator.js',
'src/component/DragState.js',
'src/component/EventManager.js',
'src/component/ImageLoader.js',
'src/component/JcropTouch.js',
'src/component/KeyWatcher.js',
'src/component/Selection.js',
'src/component/StageDrag.js',
'src/component/StageManager.js',
'src/component/Thumbnailer.js',
'src/component/DialDrag.js',
'src/defaults.js',
'src/api.js',
'src/plugin.js',
'src/modernizr.js',
'src/outro.js'
];
var json = grunt.file.readJSON('package.json');
// Project configuration
grunt.initConfig({
pkg: json,
watch: {
css: {
files: [ 'src/**/*.less' ],
tasks: [ 'css' ]
},
js: {
files: [ 'src/**/*.js' ],
tasks: [ 'js' ]
}
},
concat: {
options: {
banner: '/*! <%= pkg.name %>.js v<%= pkg.version %> - build: <%= grunt.template.today("yyyymmdd") %>\n'+
' * @copyright 2008-2015 Tapmodo Interactive LLC\n' +
' * @license Free software under MIT License\n'+
' * @website http://jcrop.org/\n'+
' **/\n'
},
dist: {
src: jcrop_sources,
dest: 'js/<%= pkg.name %>.js'
}
},
less: {
dist: {
files: {
"css/Jcrop.css": "src/css/Jcrop.less"
}
}
},
cssmin: {
dist: {
options: {
keepSpecialComments: 0,
banner: '/*! <%= pkg.name %>.min.css v<%= pkg.version %> - build: <%= grunt.template.today("yyyymmdd") %>\n'+
' * Copyright 2008-2015 Tapmodo Interactive LLC\n' +
' * Free software under MIT License\n'+
' **/\n'
},
files: {
"css/Jcrop.min.css": "css/Jcrop.css"
}
}
},
usebanner: {
dist: {
options: {
banner: '/*! <%= pkg.name %>.css v<%= pkg.version %> - build: <%= grunt.template.today("yyyymmdd") %>\n'+
' * Copyright 2008-2015 Tapmodo Interactive LLC\n' +
' * Free software under MIT License\n'+
' **/\n'
},
files: {
src: [ 'css/Jcrop.css' ]
}
}
},
uglify: {
options: {
banner: '/*! <%= pkg.name %>.min.js v<%= pkg.version %> - build: <%= grunt.template.today("yyyymmdd") %>\n' +
' * Copyright 2008-2015 Tapmodo Interactive LLC\n' +
' * Free software under MIT License\n'+
' **/\n'
},
dist: {
src: 'js/<%= pkg.name %>.js',
dest: 'js/<%= pkg.name %>.min.js'
}
}
});
// Load grunt plugins
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-less');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-banner');
// Default tasks
grunt.registerTask('default', ['js','css']);
grunt.registerTask('js', ['concat','uglify']);
grunt.registerTask('css', ['less','cssmin','usebanner']);
};