This repository has been archived by the owner on May 10, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Gruntfile.js
206 lines (189 loc) · 7.59 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
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
module.exports = function (grunt)
{
'use strict';
// Load Grunt plugins.
grunt.loadNpmTasks('grunt-combine-media-queries');
grunt.loadNpmTasks('grunt-contrib-compass');
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-cssmin');
grunt.loadNpmTasks('grunt-contrib-jshint');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-dev-update');
grunt.loadNpmTasks('grunt-replace');
grunt.loadNpmTasks('grunt-shell');
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
// Use 'config.rb' file to configure Compass.
compass: {
dev: {
options: {
config: 'config.rb',
force: true
}
}
},
// Combine any matching media queries.
cmq: {
css: {
files: {
'tmp/assets/css': [
'tmp/assets/css/*.css',
// Ignore these non-concatenated files.
'!tmp/assets/css/style.css',
'!tmp/assets/css/jquery-ui.css'
]
}
}
},
// Concatenate CSS files prior to matching media queries.
concat: {
css: {
src: [
'tmp/assets/css/style.css',
'tmp/assets/css/jquery-ui.css',
'src/assets/js/libs/flowplayer/skin/minimalist.css'
],
dest: 'tmp/assets/css/main.css'
}
},
// Copy files from `src/` and `bower_components/` to `public/`.
copy: {
img: {
files: [
{expand: true, cwd: 'src/assets/img/', src: ['**'], dest: 'public/assets/img/txpmag/'},
{expand: true, cwd: 'bower_components/textpattern-branding/assets/img/', src: ['**'], dest: 'public/assets/img/branding/'},
{expand: true, cwd: 'bower_components/textpattern-branding/assets/img/apple-touch-icon/txpmag/', src: ['**'], dest: 'public/'},
{expand: true, cwd: 'bower_components/textpattern-branding/assets/img/favicon/txpmag/', src: ['**'], dest: 'public/'},
{expand: true, cwd: 'bower_components/textpattern-branding/assets/img/windows-site-tile/txpmag/', src: ['**'], dest: 'public/'}
]
},
js: {
files: [
{expand: true, cwd: 'src/', src: ['*'], dest: 'public/', filter: 'isFile'},
{expand: true, cwd: 'src/assets/js/libs/', src: ['**'], dest: 'public/assets/js/'}
]
},
// Copy Flowplayer images and fonts to CSS folder (because Flowplayer's CSS expects relative path of `img/`).
css: {
files: [
{expand: true, cwd: 'src/assets/js/libs/flowplayer/skin/img/', src: ['**'], dest: 'public/assets/css/img/'},
{expand: true, cwd: 'src/assets/js/libs/flowplayer/skin/fonts/', src: ['**'], dest: 'public/assets/css/fonts/'}
]
}
},
// Minify and copy CSS files to `public/assets/css/`.
cssmin: {
main: {
options: {
rebase: false
},
files: {
'public/assets/css/main.css': ['tmp/assets/css/main.css'],
'public/assets/css/ie8.css': ['tmp/assets/css/ie8.css']//,
//'public/assets/css/design-patterns.css': ['tmp/assets/css/design-patterns.css']
}
}
},
// Report on any available updates for development dependencies.
devUpdate: {
main: {
options: {
updateType: 'report',
reportUpdated: false // Don't report up-to-date packages.
}
}
},
// Check code quality of Gruntfile.js and site-specific JavaScript using JSHint.
jshint: {
files: ['Gruntfile.js', 'src/assets/js/*.js'],
options: {
bitwise: true,
camelcase: true,
curly: true,
eqeqeq: true,
es3: true,
forin: true,
immed: true,
indent: 4,
latedef: true,
noarg: true,
noempty: true,
nonew: true,
quotmark: 'single',
undef: true,
unused: true,
strict: true,
trailing: true,
browser: true,
globals: {
jQuery: true,
Zepto: true,
define: true,
module: true,
require: true,
requirejs: true,
responsiveNav: true,
prettyPrint: true
}
}
},
// Run Textpattern setup script.
shell: {
setup: {
command: [
'php src/setup/setup.php'
].join('&&'),
options: {
stdout: true
}
}
},
// Uglify and copy JavaScript files from `bower-components`, and also `main.js`, to `public/assets/js/`.
uglify: {
dist: {
// Preserve all comments that start with a bang (!) or include a closure compiler style.
options: {
preserveComments: 'some'
},
files: [
{
'public/assets/js/main.js': ['src/assets/js/main.js'],
'public/assets/js/details.js': ['bower_components/jquery-details/jquery.details.js'],
'public/assets/js/prettify.js': ['bower_components/google-code-prettify/src/prettify.js'],
'public/assets/js/require.js': ['bower_components/requirejs/require.js'],
'public/assets/js/cookie.js': ['bower_components/jquery.cookie/jquery.cookie.js'],
'public/assets/js/responsivenav.js': ['bower_components/responsive-nav/responsive-nav.js'],
'public/assets/js/autosize.js': ['bower_components/jquery-autosize/jquery.autosize.js']
},
{
expand: true,
cwd: 'bower_components/google-code-prettify/src/',
src: 'lang-*.js',
dest: 'public/assets/js/'
}
]
}
},
// Directories watched and tasks performed by invoking `grunt watch`.
watch: {
sass: {
files: 'src/assets/sass/**',
tasks: ['sass']
},
js: {
files: 'src/assets/js/*.js',
tasks: ['jshint', 'copy:js', 'uglify']
}
}
});
// Register tasks.
grunt.registerTask('build', ['jshint', 'sass', 'copy:img', 'copy:js', 'uglify']);
grunt.registerTask('default', ['watch']);
grunt.registerTask('sass', ['compass', 'concat', 'cmq', 'cssmin', 'copy:css']);
grunt.registerTask('setup', ['shell:setup']);
grunt.registerTask('test', ['jshint']);
grunt.registerTask('travis', ['jshint', 'compass']);
grunt.registerTask('updatedev', ['devUpdate']);
};