-
Notifications
You must be signed in to change notification settings - Fork 84
/
Copy pathGruntfile.js
137 lines (132 loc) · 3.76 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
var path = require("path");
module.exports = function(grunt) {
grunt.initConfig({
concat: {
// packing the nodejs code
absurd: {
src: [
'lib/**/*.js',
'!lib/CLI.js',
'!lib/API.js',
'!lib/api/handlecss.js',
'!lib/api/handlecssrule.js',
'!lib/api/handlecssimport.js',
'!lib/api/import.js',
'!lib/api/express.js',
'!lib/processors/css/organic/**/*.*',
'!lib/helpers/CSS2JSON.js'
],
dest: 'tasks/tmp/absurd.js',
options: {
process: function(src, filepath) {
var moduleDef = filepath
.replace(/\//g, '.')
.replace(/\//g, '.')
.replace(/\.js/g, '');
return src.replace("module.exports", moduleDef);
}
}
},
// packing organic framework
organic: {
src: [
'lib/processors/css/organic/**/*.js'
],
dest: 'tasks/tmp/absurd-organic.js',
options: {
process: function(src, filepath) {
var moduleDef = filepath
.replace(/\//g, '.')
.replace(/\//g, '.')
.replace(/\.js/g, '')
.replace('lib.processors.css.organic', 'o');
return src.replace("module.exports", moduleDef);
}
}
},
// packing client side code
'absurd-client-code': {
src: [
'client-side/lib/**/*.js',
],
dest: 'tasks/tmp/absurd-client-code.js',
},
// packing client side code
'absurd-organic-client-code': {
src: [
'client-side/lib-organic/**/*.js',
],
dest: 'tasks/tmp/absurd-organic-client-code.js',
},
// packing the nodejs tests for client-side usage
'node-tests-to-client': {
src: [
'tests/common/*.js',
'tests/bugs/*.js',
'tests/metamorphosis/**/*.js',
'tests/componenting/**/*.js',
'tests/di/*.js',
'tests/organic/*.js',
'tests/experimental/move.selector.up.spec.js',
'tests/experimental/same.property.diff.value.spec.js',
'tests/experimental/error.reporting.spec.js',
'tests/experimental/dynamic.css.spec.js',
'!tests/common/api.import.spec.js',
'!tests/common/compile-and-save.spec.js',
'!tests/common/minify.spec.js',
'!tests/common/using-css.spec.js',
'!tests/common/using-json.spec.js',
'!tests/common/using-yaml.spec.js',
'!tests/common/basics-and-compilation.spec.js',
'!tests/common/cli.spec.js',
'!tests/common/variables-and-functions.spec.js',
'!tests/common/adding-raw-external-data.spec.js',
'!tests/common/define.external.css.spec.js',
'!tests/common/return-processed-external-data.spec.js',
'!tests/metamorphosis/html/morph.html.import.spec.js',
'!tests/metamorphosis/html/morph.html.indentation.spec.js',
'!tests/bugs/css.import.multiple.classes.spec.js',
'!tests/bugs/use.import.in.css.file.spec.js',
'!tests/experimental/csstojson.spec.js',
'!tests/bugs/dynamic-css-in-files/*.js'
],
dest: 'client-side/tests/tests.from.node.js',
}
},
// building the client-side port of absurd and organic
build: {
index: {
dest: 'client-side/build/absurd.js',
organicDest: 'client-side/build/absurd.organic.js'
}
},
// minification
uglify: {
absurd: {
src: 'client-side/build/absurd.js',
dest: 'client-side/build/absurd.min.js'
},
organic: {
src: 'client-side/build/absurd.organic.js',
dest: 'client-side/build/absurd.organic.min.js'
}
},
// watching
watch: {
commands: {
files: [
'<%= concat.absurd.src[0] %>',
'client-side/lib/**/*.js',
'client-side/lib-organic/**/*.js',
'tests/**/*.js'
],
tasks: ['concat', 'build', 'uglify']
}
}
});
grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-watch');
grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadTasks('tasks');
grunt.registerTask('default', ['concat', 'build', 'uglify', 'watch']);
}