Skip to content

Commit 6d32f61

Browse files
committed
Add parser-lib concatination
1 parent 385f7c9 commit 6d32f61

File tree

2 files changed

+39
-21
lines changed

2 files changed

+39
-21
lines changed

Gruntfile.js

+38-20
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,39 @@ module.exports = function(grunt) {
1010
'<%= pkg.homepage ? "* " + pkg.homepage + "\\n" : "" %>' +
1111
'* Copyright (c) <%= grunt.template.today("yyyy") %> Nicole Sullivan and Nicholas C. Zakas;\n' +
1212
'* Licensed <%= _.pluck(pkg.licenses, "type").join(", ") %> <%= _.pluck(pkg.licenses, "url").join(", ") %> */\n',
13+
//Parser lib copy for verions that can't user requirejs
14+
parserlib: 'node_modules/parserlib/lib/node-parserlib.js',
15+
//Core CSSLint files used by most versions
16+
csslint_files: [
17+
'src/core/CSSLint.js',
18+
'src/core/*.js',
19+
'src/rules/*.js',
20+
'src/formatters/*.js'
21+
],
22+
//Core fileset used by most versions
23+
core_files: [
24+
'<%= parserlib %>',
25+
'<%= csslint_files %>'
26+
],
1327
// Task configuration.
1428
concat: {
1529
core: {
1630
options: {
17-
banner: '<%= banner %>\nvar CSSLint = (function(){',
31+
banner: '<%= banner %>\n' +
32+
//Hack for using the node version of parserlib
33+
'var exports = exports || {};\n' +
34+
'var CSSLint = (function(){\n',
1835
footer: '\nreturn CSSLint;\n})();'
1936
},
2037
src: [
21-
'src/core/CSSLint.js',
22-
'src/core/*.js',
23-
'src/rules/*.js',
24-
'src/formatters/*.js'
38+
'<%= core_files %>'
2539
],
2640
dest: 'build/<%= pkg.name %>.js'
2741
},//Build environment workers
2842
rhino: {
43+
options: {
44+
banner: 'var exports = exports || {};\n' //Hack for using the node version of parserlib
45+
},
2946
src: [
3047
'<%= concat.core.dest %>',
3148
'src/cli/{common, rhino}.js'
@@ -37,13 +54,10 @@ module.exports = function(grunt) {
3754
banner: '<%= banner %>',
3855
footer: '\nexports.CSSLint = CSSLint;'
3956
},
40-
src: [
41-
'src/core/CSSLint.js',
42-
'src/core/*.js',
43-
'src/rules/*.js',
44-
'src/formatters/*.js'
45-
],
46-
dest: 'build/<%= pkg.name %>-node.js'
57+
files: {
58+
'build/<%= pkg.name %>-node.js': ['<%= core_files %>'],
59+
'build/npm/lib/<%= pkg.name %>-node.js': ['<%= core_files %>']
60+
}
4761
},
4862
node_cli: {
4963
options: {
@@ -56,20 +70,24 @@ module.exports = function(grunt) {
5670
},
5771
worker: {
5872
options: {
59-
banner: '<%= banner %>'
73+
banner: '<%= banner %>\n' +
74+
//Hack for using the node version of parserlib
75+
'var exports = exports || {};\n'
6076
},
6177
src: [
62-
'src/core/CSSLint.js',
63-
'src/core/*.js',
64-
'src/rules/*.js',
65-
'src/formatters/*.js',
78+
'<%= core_files %>',
6679
'src/worker/*.js'
6780
],
6881
dest: 'build/<%= pkg.name %>-worker.js'
6982
},
7083
whs: {
84+
options: {
85+
banner: '<%= banner %>\n' +
86+
//Hack for using the node version of parserlib
87+
'var exports = exports || {};\n'
88+
},
7189
src: [
72-
'<%= concat.core.dest %>',
90+
'<%= core_files %>',
7391
'src/cli/{common, whs}.js'
7492
],
7593
dest: 'build/<%= pkg.name %>-whs.js'
@@ -79,14 +97,14 @@ module.exports = function(grunt) {
7997
'!tests/all-rules.js',
8098
'tests/**/*.js'
8199
],
82-
dest: 'build/npm/cli.js'
100+
dest: 'build/<%= pkg.name %>-tests.js'
83101
},
84102
tests_node: {
85103
src: [
86104
'<%= concat.core.dest %>',
87105
'tests/**/*.js'
88106
],
89-
dest: 'build/npm/cli.js'
107+
dest: 'build/<%= pkg.name %>-node-tests.js'
90108
}
91109
},
92110
uglify: {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
},
88
"contributors": [
99
{
10-
"name": "Nicole Sullivan"
10+
"name": "Nicole Sullivan"
1111
}
1212
],
1313
"engines": {

0 commit comments

Comments
 (0)