-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathGruntfile.js
127 lines (115 loc) · 3.17 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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
/*
* Copyright (c) 2014 Eltrino LLC (http://eltrino.com)
*
* Licensed under the Open Software License (OSL 3.0).
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://opensource.org/licenses/osl-3.0.php
*
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@eltrino.com so we can send you a copy immediately.
*/
module.exports = function(grunt) {
require('time-grunt')(grunt);
require('load-grunt-tasks')(grunt);
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
assetsDir: grunt.option('assets-dir', 'Resources/assets'),
publicDir: grunt.option('public-dir', 'Resources/public'),
lessDir: '<%= assetsDir %>/less',
sync: {
main: {
files: [{
expand: true,
cwd: '<%= assetsDir %>',
src: [ '**/*', '**/.*','.htaccess', '!less/**', '!less' ],
dest: '<%= publicDir %>'
}],
//pretend: true, // Don't do any disk operations - just write log
//verbose: true, // Display log messages when copying files
ignoreInDest: ['css/**', 'less', 'js/main.built.js'],
updateAndDelete: true
}
},
less: {
main : {
options: {
sourceMap: true,
outputSourceFiles: true,
sourceMapURL: 'main.css.map',
sourceMapFilename: '<%= publicDir %>/css/main.css.map'
},
files: {
'<%= publicDir %>/css/main.css': '<%= lessDir %>/main.less'
}
},
wysiwyg: {
files: {
'<%= publicDir %>/css/wysiwyg.css': '<%= lessDir %>/wysiwyg.less'
}
}
},
cssmin: {
main: {
options: {
advanced: false
},
files: {
'<%= publicDir %>/css/main.min.css': '<%= publicDir %>/css/main.css'
}
}
},
requirejs: {
main: {
options: {
baseUrl: '<%= assetsDir %>/js/',
optimize: 'uglify',
findNestedDependencies: true,
wrapShim: true,
name: 'main',
mainConfigFile: '<%= assetsDir %>/js/main.js',
out: '<%= publicDir %>/js/main.built.js',
paths: {
translations: 'empty:'
}
}
}
},
jshint: {
options: {
jshintrc: true
},
main : [
'Gruntfile.js',
'<%=assetsDir%>/js/**/*.js',
'!<%=assetsDir%>/js/main.built.js',
'!<%=assetsDir%>/js/vendor/**'
]
},
watch: {
css: {
files: ['<%= publicDir %>/css/main.css', '<%= publicDir %>/css/main.min.css'],
options: {
livereload: true
}
},
main: {
files: '<%= assetsDir %>/**',
tasks: ['sync']
},
less : {
files: '<%= lessDir %>/**',
tasks: ['css']
},
js : {
files: ['<%=assetsDir%>/js/**/*.js','<%=assetsDir%>/js/**/*.ejs'],
tasks: ['js']
}
}
});
grunt.registerTask('js', ['jshint', 'requirejs']);
grunt.registerTask('css', ['less', 'cssmin']);
grunt.registerTask('default', ['js','sync', 'css']);
};