-
Notifications
You must be signed in to change notification settings - Fork 14
/
Gruntfile.js
67 lines (61 loc) · 2.54 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
module.exports = function (grunt) {
grunt.initConfig({
wiredep: {
task: {
// Point to the files that should be updated when
// you run `grunt wiredep`
src: [
'templates/base/head/base.html'
],
ignorePath: '../../../bower_components/',
fileTypes: {
html: {
block: /(([ \t]*)<!--\s*bower:*(\S*)\s*-->)(\n|\r|.)*?(<!--\s*endbower\s*-->)/gi,
detect: {
js: /<script.*src=['"]([^'"]+)/gi,
css: /<link.*href=['"]([^'"]+)/gi
},
replace: {
js: '<script src="{% static "{{filePath}}" %}"></script>',
css: '<link rel="stylesheet" href="{% static "{{filePath}}" %}" />'
}
}
},
options: {
// See wiredep's configuration documentation for the options
// you may pass:
// https://github.com/taptapship/wiredep#configuration
}
}
},
includeSource: {
options: {
basePath: '.',
baseUrl: '',
templates: {
html: {
js: '<script type="text/javascript" src="{% static "{filePath}" %}"></script>',
css: '<link rel="stylesheet" type="text/css" href="{%static "{filePath}"%}" />',
scss: '<link rel="stylesheet" type="text/x-scss" href="{%static "{filePath}"%}" />',
sass: '<link rel="stylesheet" type="text/x-sass" href="{%static "{filePath}"%}" />',
}
},
rename: function (dest, matchedSrcPath, options) {
var slicer = 2;
if (matchedSrcPath.indexOf("apps") > -1)
slicer++;
matchedSrcPath = matchedSrcPath.split("/").slice(slicer, 10).join("/");
return dest + matchedSrcPath;
}
},
myTarget: {
files: {
'templates/base/head/base.html': 'templates/base/head/base.tpl.html'
}
}
}
});
grunt.loadNpmTasks('grunt-wiredep');
grunt.loadNpmTasks('grunt-include-source');
grunt.registerTask('default', ['wiredep']);
};