Skip to content

Commit 3a76dcc

Browse files
committed
Converted plugins to *.less + added to build.
1 parent 3c7b439 commit 3a76dcc

35 files changed

+872
-389
lines changed

Gruntfile.js

Lines changed: 53 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -9,14 +9,16 @@ module.exports = function(grunt) {
99
grunt.registerTask('default', [
1010
'clean:pre',
1111
'bower:install',
12+
'copy:less',
13+
'copy:less_plugins',
14+
'concat:less_theme_dependencies',
15+
'concat:less_plugins',
1216
'concat:js',
13-
'concat:css_theme_dependencies',
1417
'recess',
1518
'replace',
1619
'concat:js_standalone',
1720
'uglify',
1821
'clean:post',
19-
'copy:less'
2022
]);
2123

2224
var files_js = [
@@ -32,18 +34,29 @@ module.exports = function(grunt) {
3234
'bower_components/sifter/sifter.js'
3335
];
3436

35-
var files_css = [
36-
'src/*.css'
37-
];
37+
var less_imports = [];
38+
var less_plugin_files = [];
39+
40+
// enumerate plugins
41+
(function() {
42+
var selector_plugins = grunt.option('plugins');
43+
if (!selector_plugins) return;
44+
45+
if (selector_plugins.indexOf(',') !== -1) {
46+
selector_plugins = '{' + plugins.split(/\s*,\s*/).join(',') + '}';
47+
}
48+
49+
// javascript
50+
files_js.push('src/plugins/' + selector_plugins + '/*.js');
3851

39-
var plugins = grunt.option('plugins');
40-
if (plugins) {
41-
if (plugins.indexOf(',') !== -1) {
42-
plugins = '{' + plugins.split(/\s*,\s*/).join(',') + '}';
52+
// less (css)
53+
var matched_files = grunt.file.expand(['src/plugins/' + selector_plugins + '/plugin.less']);
54+
for (var i = 0, n = matched_files.length; i < n; i++) {
55+
var plugin_name = matched_files[i].match(/src\/plugins\/(.+?)\//)[1];
56+
less_imports.push('@import "plugins/' + plugin_name + '";');
57+
less_plugin_files.push({src: matched_files[i], dest: 'dist/less/plugins/' + plugin_name + '.less'});
4358
}
44-
files_js.push('src/plugins/' + plugins + '/*.js');
45-
files_css.push('src/plugins/' + plugins + '/*.css');
46-
}
59+
})();
4760

4861
grunt.initConfig({
4962
pkg: grunt.file.readJSON('bower.json'),
@@ -57,11 +70,14 @@ module.exports = function(grunt) {
5770
},
5871
clean: {
5972
pre: ['dist'],
60-
post: ['src/css/*.tmp*']
73+
post: ['**/*.tmp*']
6174
},
6275
copy: {
6376
less: {
6477
files: [{expand: true, flatten: true, src: ['src/css/*.less'], dest: 'dist/less'}]
78+
},
79+
less_plugins: {
80+
files: less_plugin_files
6581
}
6682
},
6783
replace: {
@@ -86,7 +102,9 @@ module.exports = function(grunt) {
86102
},
87103
},
88104
files: [
89-
{expand: true, flatten: false, src: ['dist/css/*.css'], dest: ''}
105+
{expand: true, flatten: false, src: ['dist/css/*.css'], dest: ''},
106+
{expand: true, flatten: false, src: ['dist/less/*.less'], dest: ''},
107+
{expand: true, flatten: false, src: ['dist/less/plugins/*.less'], dest: ''},
90108
]
91109
}
92110
},
@@ -96,21 +114,21 @@ module.exports = function(grunt) {
96114
},
97115
uncompressed: {
98116
files: {
99-
'dist/css/selectize.css': ['src/css/selectize.less'],
100-
'dist/css/selectize.default.css': ['src/css/selectize.default.less'],
101-
'dist/css/selectize.bootstrap2.css': ['src/css/selectize.bootstrap2.tmp.less'],
102-
'dist/css/selectize.bootstrap3.css': ['src/css/selectize.bootstrap3.tmp.less']
117+
'dist/css/selectize.css': ['dist/less/selectize.less'],
118+
'dist/css/selectize.default.css': ['dist/less/selectize.default.less'],
119+
'dist/css/selectize.bootstrap2.css': ['dist/less/selectize.bootstrap2.tmp.less'],
120+
'dist/css/selectize.bootstrap3.css': ['dist/less/selectize.bootstrap3.tmp.less']
103121
}
104122
},
105123
compressed: {
106124
options: {
107125
compress: true
108126
},
109127
files: {
110-
'dist/css/selectize.min.css': ['src/css/selectize.less'],
111-
'dist/css/selectize.default.min.css': ['src/css/selectize.default.less'],
112-
'dist/css/selectize.bootstrap2.min.css': ['src/css/selectize.bootstrap2.tmp.less'],
113-
'dist/css/selectize.bootstrap3.min.css': ['src/css/selectize.bootstrap3.tmp.less']
128+
'dist/css/selectize.min.css': ['dist/less/selectize.less'],
129+
'dist/css/selectize.default.min.css': ['dist/less/selectize.default.less'],
130+
'dist/css/selectize.bootstrap2.min.css': ['dist/less/selectize.bootstrap2.tmp.less'],
131+
'dist/css/selectize.bootstrap3.min.css': ['dist/less/selectize.bootstrap3.tmp.less']
114132
}
115133
}
116134
},
@@ -124,18 +142,26 @@ module.exports = function(grunt) {
124142
'dist/js/selectize.js': files_js,
125143
}
126144
},
127-
css_theme_dependencies: {
145+
less_plugins: {
146+
options: {
147+
banner: less_imports.join('\n') + grunt.util.linefeed + grunt.util.linefeed
148+
},
149+
files: {
150+
'dist/less/selectize.less': ['dist/less/selectize.less']
151+
}
152+
},
153+
less_theme_dependencies: {
128154
options: {stripBanners: false},
129155
files: {
130-
'src/css/selectize.bootstrap2.tmp.less': [
156+
'dist/less/selectize.bootstrap2.tmp.less': [
131157
'bower_components/bootstrap2/less/variables.less',
132158
'bower_components/bootstrap2/less/mixins.less',
133-
'src/css/selectize.bootstrap2.less'
159+
'dist/less/selectize.bootstrap2.less'
134160
],
135-
'src/css/selectize.bootstrap3.tmp.less': [
161+
'dist/less/selectize.bootstrap3.tmp.less': [
136162
'bower_components/bootstrap3/less/variables.less',
137163
'bower_components/bootstrap3/less/mixins.less',
138-
'src/css/selectize.bootstrap3.less'
164+
'dist/less/selectize.bootstrap3.less'
139165
]
140166
}
141167
},

dist/css/selectize.bootstrap2.css

Lines changed: 127 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
}
3232

3333
/**
34-
* selectize.css (v0.6.14) - Bootstrap 2 Theme
34+
* selectize.bootstrap2.css (v0.6.14) - Bootstrap 2 Theme
3535
* Copyright (c) 2013 Brian Reavis & contributors
3636
*
3737
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this
@@ -46,6 +46,102 @@
4646
* @author Brian Reavis <[email protected]>
4747
*/
4848

49+
.selectize-control.plugin-drag_drop.multi > .selectize-input > div.ui-sortable-placeholder {
50+
background: #f2f2f2 !important;
51+
background: rgba(0, 0, 0, 0.06) !important;
52+
border: 0 none !important;
53+
visibility: visible !important;
54+
-webkit-box-shadow: inset 0 0 12px 4px #ffffff;
55+
box-shadow: inset 0 0 12px 4px #ffffff;
56+
}
57+
58+
.selectize-control.plugin-drag_drop .ui-sortable-placeholder::after {
59+
content: '!';
60+
visibility: hidden;
61+
}
62+
63+
.selectize-control.plugin-drag_drop .ui-sortable-helper {
64+
-webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
65+
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
66+
}
67+
68+
.selectize-dropdown-header {
69+
position: relative;
70+
padding: 3px 10px;
71+
background: #f8f8f8;
72+
border-bottom: 1px solid #d0d0d0;
73+
-webkit-border-radius: 4px 4px 0 0;
74+
-moz-border-radius: 4px 4px 0 0;
75+
border-radius: 4px 4px 0 0;
76+
}
77+
78+
.selectize-dropdown-header-close {
79+
position: absolute;
80+
top: 50%;
81+
right: 10px;
82+
margin-top: -12px;
83+
font-size: 20px !important;
84+
line-height: 20px;
85+
color: #333333;
86+
opacity: 0.4;
87+
}
88+
89+
.selectize-dropdown-header-close:hover {
90+
color: #000000;
91+
}
92+
93+
.selectize-dropdown.plugin-optgroup_columns .optgroup {
94+
float: left;
95+
border-right: 1px solid #f2f2f2;
96+
-webkit-box-sizing: border-box;
97+
-moz-box-sizing: border-box;
98+
box-sizing: border-box;
99+
}
100+
101+
.selectize-dropdown.plugin-optgroup_columns .optgroup:last-child {
102+
border-right: 0 none;
103+
}
104+
105+
.selectize-dropdown.plugin-optgroup_columns .optgroup-header {
106+
border-top: 0 none;
107+
}
108+
109+
.selectize-control.plugin-remove_button .item {
110+
position: relative;
111+
padding-right: 24px !important;
112+
}
113+
114+
.selectize-control.plugin-remove_button .item .remove {
115+
position: absolute;
116+
top: 0;
117+
right: 0;
118+
bottom: 0;
119+
display: inline-block;
120+
width: 17px;
121+
padding: 7px 0 0 0;
122+
font-size: 12px;
123+
font-weight: bold;
124+
line-height: 8px;
125+
color: inherit;
126+
text-align: center;
127+
vertical-align: middle;
128+
border-left: 1px solid #cccccc;
129+
-webkit-border-radius: 0 2px 2px 0;
130+
-moz-border-radius: 0 2px 2px 0;
131+
border-radius: 0 2px 2px 0;
132+
-webkit-box-sizing: border-box;
133+
-moz-box-sizing: border-box;
134+
box-sizing: border-box;
135+
}
136+
137+
.selectize-control.plugin-remove_button .item .remove:hover {
138+
background: rgba(0, 0, 0, 0.05);
139+
}
140+
141+
.selectize-control.plugin-remove_button .item.active .remove {
142+
border-left-color: #0077b3;
143+
}
144+
49145
.selectize-control {
50146
position: relative;
51147
}
@@ -74,7 +170,7 @@
74170
width: 100%;
75171
padding: 7px 10px;
76172
overflow: hidden;
77-
border: 1px solid #cccccc;
173+
border: 1px solid #d0d0d0;
78174
-webkit-border-radius: 4px;
79175
-moz-border-radius: 4px;
80176
border-radius: 4px;
@@ -94,7 +190,7 @@
94190
}
95191

96192
.selectize-input.disabled,
97-
.selectize-input.disabled input {
193+
.selectize-input.disabled * {
98194
cursor: default !important;
99195
}
100196

@@ -120,7 +216,23 @@
120216
.selectize-control.multi .selectize-input > div {
121217
padding: 1px 3px;
122218
margin: 0 3px 3px 0;
219+
color: #333333;
123220
cursor: pointer;
221+
background: #e6e6e6;
222+
border: 1px solid #cccccc;
223+
}
224+
225+
.selectize-control.multi .selectize-input > div.active {
226+
color: #ffffff;
227+
background: #0088cc;
228+
border: 1px solid #0077b3;
229+
}
230+
231+
.selectize-control.multi .selectize-input.disabled > div,
232+
.selectize-control.multi .selectize-input.disabled > div.active {
233+
color: #474747;
234+
background: #fafafa;
235+
border: 1px solid #e0e0e0;
124236
}
125237

126238
.selectize-input > input {
@@ -164,7 +276,7 @@
164276
z-index: 2;
165277
margin-top: -1px;
166278
background: #ffffff;
167-
border: 1px solid #cccccc;
279+
border: 1px solid #d0d0d0;
168280
border-top: 0 none;
169281
-webkit-border-radius: 0 0 4px 4px;
170282
-moz-border-radius: 0 0 4px 4px;
@@ -200,7 +312,7 @@
200312
.selectize-dropdown .optgroup-header {
201313
color: #999999;
202314
cursor: default;
203-
background: inherit;
315+
background: #f8f8f8;
204316
}
205317

206318
.selectize-dropdown .active {
@@ -213,7 +325,7 @@
213325
}
214326

215327
.selectize-dropdown .create {
216-
color: inherit;
328+
color: #a0a0a0;
217329
}
218330

219331
.selectize-dropdown-content {
@@ -259,7 +371,6 @@
259371

260372
.selectize-dropdown {
261373
z-index: 1000;
262-
padding: 5px 0;
263374
margin: 2px 0 0 0;
264375
border: 1px solid rgba(0, 0, 0, 0.2);
265376
border-radius: 4px;
@@ -304,6 +415,14 @@
304415
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0);
305416
}
306417

418+
.selectize-dropdown-content {
419+
padding: 5px 0;
420+
}
421+
422+
.selectize-dropdown-header {
423+
padding: 6px 10px;
424+
}
425+
307426
.selectize-input {
308427
-webkit-transition: border linear 0.2s, box-shadow linear 0.2s;
309428
-moz-transition: border linear 0.2s, box-shadow linear 0.2s;
@@ -400,7 +519,7 @@
400519
color: #333333;
401520
text-shadow: none;
402521
background-color: #f5f5f5;
403-
*background-color: #ffffff;
522+
*background-color: #e6e6e6;
404523
background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6);
405524
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6));
406525
background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6);

dist/css/selectize.bootstrap2.min.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)