Skip to content

Commit dfcdf60

Browse files
committed
Fixed build script.
1 parent 34f1d18 commit dfcdf60

3 files changed

Lines changed: 29 additions & 36 deletions

File tree

Gruntfile.js

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ module.exports = function(grunt) {
2323
'recess',
2424
'clean_bootstrap2_css',
2525
'replace',
26-
'concat:js_standalone',
26+
'build_standalone',
2727
'uglify',
2828
'clean:post',
2929
]);
@@ -36,10 +36,33 @@ module.exports = function(grunt) {
3636
grunt.registerTask('clean_bootstrap2_css', 'Cleans CSS rules ocurring before the header comment.', function() {
3737
var file = 'dist/css/selectize.bootstrap2.css';
3838
var source = fs.readFileSync(file, 'utf8');
39-
fs.writeFileSync(file, source.replace(/^(.|\s)+?\/\*/m, '/*'), 'utf8');
39+
grunt.file.write(file, source.replace(/^(.|\s)+?\/\*/m, '/*'));
4040
grunt.log.writeln('Cleaned "' + file + '".');
4141
});
4242

43+
grunt.registerTask('build_standalone', '', function() {
44+
var files, i, n, source, name, path, modules = [];
45+
46+
// amd definitions must be changed to be not anonymous
47+
// @see https://github.com/brianreavis/selectize.js/issues/89
48+
files = [];
49+
for (i = 0, n = files_js_dependencies.length; i < n; i++) {
50+
path = files_js_dependencies[i];
51+
name = path.match(/([^\/]+?).js$/)[1];
52+
source = grunt.file.read(path).replace('define(factory);', 'define(\'' + name + '\', factory);');
53+
modules.push(source);
54+
}
55+
56+
path = 'dist/js/selectize.js';
57+
source = grunt.file.read(path).replace(/define\((.*?)factory\);/, 'define(\'selectize\', $1factory);');
58+
modules.push(source);
59+
60+
// write output
61+
path = 'dist/js/standalone/selectize.js';
62+
grunt.file.write(path, modules.join('\n\n'));
63+
grunt.log.writeln('Built "' + path + '".');
64+
});
65+
4366
var files_js = [
4467
'src/contrib/*.js',
4568
'src/*.js',
@@ -177,36 +200,6 @@ module.exports = function(grunt) {
177200
'dist/less/selectize.bootstrap3.less'
178201
]
179202
}
180-
},
181-
js_standalone: {
182-
options: {
183-
stripBanners: false
184-
},
185-
files: {
186-
'dist/js/standalone/selectize.js': (function() {
187-
var files, i, n, source, name, path;
188-
189-
// amd definitions must be changed to be not anonymous
190-
// @see https://github.com/brianreavis/selectize.js/issues/89
191-
path = 'dist/js/selectize.js';
192-
source = fs.readFileSync(path, 'utf8').replace(/define\((.*?)factory\);/, 'define(\'selectize\', $1factory);');
193-
fs.writeFileSync('selectize.tmp.js', source, 'utf8');
194-
195-
// dependencies
196-
files = [];
197-
for (i = 0, n = files_js_dependencies.length; i < n; i++) {
198-
path = files_js_dependencies[i];
199-
name = path.match(/([^\/]+?).js$/)[1];
200-
source = fs.readFileSync(path, 'utf8').replace('define(factory);', 'define(\'' + name + '\', factory);');
201-
fs.writeFileSync(path, source, 'utf8');
202-
203-
files.push(path);
204-
}
205-
206-
files.push('selectize.tmp.js');
207-
return files;
208-
})()
209-
}
210203
}
211204
},
212205
uglify: {

dist/css/selectize.bootstrap3.css

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -297,12 +297,12 @@
297297
}
298298

299299
.selectize-dropdown .active {
300-
color: #ffffff;
301-
background-color: #428bca;
300+
color: #262626;
301+
background-color: #f5f5f5;
302302
}
303303

304304
.selectize-dropdown .active.create {
305-
color: #ffffff;
305+
color: #262626;
306306
}
307307

308308
.selectize-dropdown .create {

dist/js/standalone/selectize.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,7 @@
583583
}));
584584

585585
/**
586-
* selectize.js (v0.8.4)
586+
* selectize.js (v0.8.5)
587587
* Copyright (c) 2013 Brian Reavis & contributors
588588
*
589589
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this

0 commit comments

Comments
 (0)