-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
127 lines (119 loc) · 4.58 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
/*global module:false*/
module.exports = function(grunt) {
// Project configuration.
grunt.initConfig({
// Metadata.
src: 'src',
dest: 'www',
nodeGlobal: '/usr/lib/node_modules',
nodeLocal: 'node_modules',
vendor: '<%= src %>/vendor',
pkg: grunt.file.readJSON('package.json'),
banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' +
'<%= grunt.template.today("yyyy-mm-dd") %>\n' +
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
'* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' +
' Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> */\n',
// Task configuration.
clean: {
init: [
'<%= vendor %>/*',
'<%= dest %>'
],
finalize: [
'<%= dest %>/css/base.css'
]
},
copy: {
install: {
files: [
{ src:"<%= src %>/config/theme.config", dest: "semantic/src/theme.config" },
]
},
main: {
files: [
{ src:"<%= nodeLocal %>/jquery/dist/jquery.min.js", dest:"<%= vendor %>/jquery/jquery.min.js" },
{ src:"<%= nodeLocal %>/requirejs/require.js", dest:"<%= vendor %>/require/require.js" },
{ src:"<%= nodeLocal %>/requirejs-text/text.js", dest:"<%= vendor %>/require/text.js" },
{ src:"<%= nodeLocal %>/requirejs-json/json.js", dest:"<%= vendor %>/require/json.js" },
{ src:"semantic/dist/semantic.min.js", dest:"<%= vendor %>/semantic/semantic.min.js" },
{ src:"semantic/dist/semantic.min.css", dest:"<%= vendor %>/semantic/semantic.min.css" },
{ src:"<%= nodeLocal %>/moment/min/moment.min.js", dest:"<%= vendor %>/moment/moment.min.js" },
{ src:"<%= nodeLocal %>/signals/dist/signals.min.js", dest:"<%= vendor %>/signals/signals.min.js" },
{ src:"<%= nodeLocal %>/crossroads/dist/crossroads.min.js", dest:"<%= vendor %>/crossroads/crossroads.min.js" },
{ src:"<%= nodeLocal %>/hasher/dist/js/hasher.min.js", dest:"<%= vendor %>/hasher/hasher.min.js" },
{ src:"<%= src %>/index.html", dest:"<%= dest %>/index.html" }
]
}
},
'string-replace': {
dist: {
files: {
'<%= dest %>/index.html': '<%= dest %>/index.html'
} ,
options: {
replacements: [{
pattern: /\.\.\/www\//ig,
replacement: ''
},
{
pattern: /config\/app|vendor\/require\/require/ig,
replacement: 'js\/prj.min'
}]
}
}
},
requirejs: {
compile: {
options: {
baseUrl: '<%= src %>/js',
name: "../config/app",
out: "<%= dest %>/js/prj.min.js",
paths: {
text: '../vendor/require/text',
json: '../vendor/require/json',
jquery: '../vendor/jquery/jquery.min',
moment: '../vendor/moment/moment.min',
crossroads: '../vendor/crossroads/crossroads.min',
hasher: '../vendor/hasher/hasher.min',
signals: '../vendor/signals/signals.min',
requireLib: '../vendor/require/require',
semanticLib: '../vendor/semantic/semantic.min'
},
include: ['requireLib', 'semanticLib']
}
}
},
sass: {
dist: {
options: {
sourcemap: 'none',
style: 'compressed'
},
files: {
'<%= dest %>/css/base.css': '<%= src %>/scss/base.scss'
},
}
},
exec: {
buildSemantic: 'gulp --gulpfile semantic/gulpfile.js build'
},
concat: {
dist: {
src: ['<%= vendor %>/semantic/semantic.min.css', '<%= dest %>/css/base.css'],
dest: '<%= dest %>/css/prj.min.css',
},
}
});
// These plugins provide necessary tasks.
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-string-replace');
grunt.loadNpmTasks('grunt-contrib-requirejs');
grunt.loadNpmTasks('grunt-contrib-sass');
grunt.loadNpmTasks('grunt-exec');
grunt.loadNpmTasks('grunt-contrib-concat');
// Default task.
grunt.registerTask('default', ['clean:init', 'copy:main', 'string-replace', 'requirejs', 'sass', 'concat', 'clean:finalize']);
grunt.registerTask('compileSemanticUITheme', ['copy:install', 'exec']);
};