forked from craftcms/feed-me
-
Notifications
You must be signed in to change notification settings - Fork 0
/
gruntfile.js
110 lines (108 loc) · 3.48 KB
/
gruntfile.js
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
module.exports = function(grunt) {
// Project Configuration
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
watch: {
sass: {
files: ['src/web/assets/feedme/dist/css/*.scss'],
tasks: 'css'
},
js: {
files: ['src/web/assets/feedme/src/js/*.js'],
tasks: ['concat', 'uglify:js']
}
},
sass: {
options: {
style: 'compact',
unixNewlines: true
},
dist: {
expand: true,
cwd: 'src/web/assets',
src: [
'**/*.scss'
],
dest: 'src/web/assets',
rename: function(dest, src) {
// Keep them where they came from
return dest + '/' + src;
},
ext: '.css'
}
},
postcss: {
options: {
map: true,
processors: [
require('autoprefixer')({browsers: 'last 2 versions'})
]
},
dist: {
expand: true,
cwd: 'src/web/assets',
src: [
'**/*.css',
],
dest: 'src/web/assets'
}
},
concat: {
js: {
options: {
banner: '/*! <%= pkg.name %> <%= pkg.version %> - <%= grunt.template.today("yyyy-mm-dd") %> */\n' +
'(function($){\n\n',
footer: '\n})(jQuery);\n'
},
src: [
'src/web/assets/feedme/src/js/_help.js',
'src/web/assets/feedme/src/js/_selectize.js',
'src/web/assets/feedme/src/js/feed-me.js',
],
dest: 'src/web/assets/feedme/dist/js/feed-me.js'
}
},
uglify: {
options: {
sourceMap: true,
preserveComments: 'some',
screwIE8: true
},
js: {
src: 'src/web/assets/feedme/dist/js/feed-me.js',
dest: 'src/web/assets/feedme/dist/js/feed-me.min.js'
},
},
jshint: {
options: {
expr: true,
laxbreak: true,
loopfunc: true, // Supresses "Don't make functions within a loop." errors
shadow: true,
strict: false,
'-W041': true,
'-W061': true
},
beforeconcat: [
'gruntfile.js',
'src/web/assets/**/*.js',
'!src/web/assets/**/*.min.js',
'!src/web/assets/feedme/dist/js/feed-me.js',
],
afterconcat: [
'src/web/assets/feedme/dist/js/feed-me.js'
]
}
});
//Load NPM tasks
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-postcss');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-jshint');
// Default task(s).
grunt.registerTask('css', ['sass', 'postcss']);
grunt.registerTask('js', ['jshint:beforeconcat', 'concat', 'jshint:afterconcat', 'uglify']);
grunt.registerTask('default', ['css', 'js']);
};