Skip to content

Commit

Permalink
Converted plugins to *.less + added to build.
Browse files Browse the repository at this point in the history
  • Loading branch information
brianreavis committed Aug 18, 2013
1 parent 3c7b439 commit 3a76dcc
Show file tree
Hide file tree
Showing 35 changed files with 872 additions and 389 deletions.
80 changes: 53 additions & 27 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,16 @@ module.exports = function(grunt) {
grunt.registerTask('default', [
'clean:pre',
'bower:install',
'copy:less',
'copy:less_plugins',
'concat:less_theme_dependencies',
'concat:less_plugins',
'concat:js',
'concat:css_theme_dependencies',
'recess',
'replace',
'concat:js_standalone',
'uglify',
'clean:post',
'copy:less'
]);

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

var files_css = [
'src/*.css'
];
var less_imports = [];
var less_plugin_files = [];

// enumerate plugins
(function() {
var selector_plugins = grunt.option('plugins');
if (!selector_plugins) return;

if (selector_plugins.indexOf(',') !== -1) {
selector_plugins = '{' + plugins.split(/\s*,\s*/).join(',') + '}';
}

// javascript
files_js.push('src/plugins/' + selector_plugins + '/*.js');

var plugins = grunt.option('plugins');
if (plugins) {
if (plugins.indexOf(',') !== -1) {
plugins = '{' + plugins.split(/\s*,\s*/).join(',') + '}';
// less (css)
var matched_files = grunt.file.expand(['src/plugins/' + selector_plugins + '/plugin.less']);
for (var i = 0, n = matched_files.length; i < n; i++) {
var plugin_name = matched_files[i].match(/src\/plugins\/(.+?)\//)[1];
less_imports.push('@import "plugins/' + plugin_name + '";');
less_plugin_files.push({src: matched_files[i], dest: 'dist/less/plugins/' + plugin_name + '.less'});
}
files_js.push('src/plugins/' + plugins + '/*.js');
files_css.push('src/plugins/' + plugins + '/*.css');
}
})();

grunt.initConfig({
pkg: grunt.file.readJSON('bower.json'),
Expand All @@ -57,11 +70,14 @@ module.exports = function(grunt) {
},
clean: {
pre: ['dist'],
post: ['src/css/*.tmp*']
post: ['**/*.tmp*']
},
copy: {
less: {
files: [{expand: true, flatten: true, src: ['src/css/*.less'], dest: 'dist/less'}]
},
less_plugins: {
files: less_plugin_files
}
},
replace: {
Expand All @@ -86,7 +102,9 @@ module.exports = function(grunt) {
},
},
files: [
{expand: true, flatten: false, src: ['dist/css/*.css'], dest: ''}
{expand: true, flatten: false, src: ['dist/css/*.css'], dest: ''},
{expand: true, flatten: false, src: ['dist/less/*.less'], dest: ''},
{expand: true, flatten: false, src: ['dist/less/plugins/*.less'], dest: ''},
]
}
},
Expand All @@ -96,21 +114,21 @@ module.exports = function(grunt) {
},
uncompressed: {
files: {
'dist/css/selectize.css': ['src/css/selectize.less'],
'dist/css/selectize.default.css': ['src/css/selectize.default.less'],
'dist/css/selectize.bootstrap2.css': ['src/css/selectize.bootstrap2.tmp.less'],
'dist/css/selectize.bootstrap3.css': ['src/css/selectize.bootstrap3.tmp.less']
'dist/css/selectize.css': ['dist/less/selectize.less'],
'dist/css/selectize.default.css': ['dist/less/selectize.default.less'],
'dist/css/selectize.bootstrap2.css': ['dist/less/selectize.bootstrap2.tmp.less'],
'dist/css/selectize.bootstrap3.css': ['dist/less/selectize.bootstrap3.tmp.less']
}
},
compressed: {
options: {
compress: true
},
files: {
'dist/css/selectize.min.css': ['src/css/selectize.less'],
'dist/css/selectize.default.min.css': ['src/css/selectize.default.less'],
'dist/css/selectize.bootstrap2.min.css': ['src/css/selectize.bootstrap2.tmp.less'],
'dist/css/selectize.bootstrap3.min.css': ['src/css/selectize.bootstrap3.tmp.less']
'dist/css/selectize.min.css': ['dist/less/selectize.less'],
'dist/css/selectize.default.min.css': ['dist/less/selectize.default.less'],
'dist/css/selectize.bootstrap2.min.css': ['dist/less/selectize.bootstrap2.tmp.less'],
'dist/css/selectize.bootstrap3.min.css': ['dist/less/selectize.bootstrap3.tmp.less']
}
}
},
Expand All @@ -124,18 +142,26 @@ module.exports = function(grunt) {
'dist/js/selectize.js': files_js,
}
},
css_theme_dependencies: {
less_plugins: {
options: {
banner: less_imports.join('\n') + grunt.util.linefeed + grunt.util.linefeed
},
files: {
'dist/less/selectize.less': ['dist/less/selectize.less']
}
},
less_theme_dependencies: {
options: {stripBanners: false},
files: {
'src/css/selectize.bootstrap2.tmp.less': [
'dist/less/selectize.bootstrap2.tmp.less': [
'bower_components/bootstrap2/less/variables.less',
'bower_components/bootstrap2/less/mixins.less',
'src/css/selectize.bootstrap2.less'
'dist/less/selectize.bootstrap2.less'
],
'src/css/selectize.bootstrap3.tmp.less': [
'dist/less/selectize.bootstrap3.tmp.less': [
'bower_components/bootstrap3/less/variables.less',
'bower_components/bootstrap3/less/mixins.less',
'src/css/selectize.bootstrap3.less'
'dist/less/selectize.bootstrap3.less'
]
}
},
Expand Down
135 changes: 127 additions & 8 deletions dist/css/selectize.bootstrap2.css
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
}

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

.selectize-control.plugin-drag_drop.multi > .selectize-input > div.ui-sortable-placeholder {
background: #f2f2f2 !important;
background: rgba(0, 0, 0, 0.06) !important;
border: 0 none !important;
visibility: visible !important;
-webkit-box-shadow: inset 0 0 12px 4px #ffffff;
box-shadow: inset 0 0 12px 4px #ffffff;
}

.selectize-control.plugin-drag_drop .ui-sortable-placeholder::after {
content: '!';
visibility: hidden;
}

.selectize-control.plugin-drag_drop .ui-sortable-helper {
-webkit-box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

.selectize-dropdown-header {
position: relative;
padding: 3px 10px;
background: #f8f8f8;
border-bottom: 1px solid #d0d0d0;
-webkit-border-radius: 4px 4px 0 0;
-moz-border-radius: 4px 4px 0 0;
border-radius: 4px 4px 0 0;
}

.selectize-dropdown-header-close {
position: absolute;
top: 50%;
right: 10px;
margin-top: -12px;
font-size: 20px !important;
line-height: 20px;
color: #333333;
opacity: 0.4;
}

.selectize-dropdown-header-close:hover {
color: #000000;
}

.selectize-dropdown.plugin-optgroup_columns .optgroup {
float: left;
border-right: 1px solid #f2f2f2;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}

.selectize-dropdown.plugin-optgroup_columns .optgroup:last-child {
border-right: 0 none;
}

.selectize-dropdown.plugin-optgroup_columns .optgroup-header {
border-top: 0 none;
}

.selectize-control.plugin-remove_button .item {
position: relative;
padding-right: 24px !important;
}

.selectize-control.plugin-remove_button .item .remove {
position: absolute;
top: 0;
right: 0;
bottom: 0;
display: inline-block;
width: 17px;
padding: 7px 0 0 0;
font-size: 12px;
font-weight: bold;
line-height: 8px;
color: inherit;
text-align: center;
vertical-align: middle;
border-left: 1px solid #cccccc;
-webkit-border-radius: 0 2px 2px 0;
-moz-border-radius: 0 2px 2px 0;
border-radius: 0 2px 2px 0;
-webkit-box-sizing: border-box;
-moz-box-sizing: border-box;
box-sizing: border-box;
}

.selectize-control.plugin-remove_button .item .remove:hover {
background: rgba(0, 0, 0, 0.05);
}

.selectize-control.plugin-remove_button .item.active .remove {
border-left-color: #0077b3;
}

.selectize-control {
position: relative;
}
Expand Down Expand Up @@ -74,7 +170,7 @@
width: 100%;
padding: 7px 10px;
overflow: hidden;
border: 1px solid #cccccc;
border: 1px solid #d0d0d0;
-webkit-border-radius: 4px;
-moz-border-radius: 4px;
border-radius: 4px;
Expand All @@ -94,7 +190,7 @@
}

.selectize-input.disabled,
.selectize-input.disabled input {
.selectize-input.disabled * {
cursor: default !important;
}

Expand All @@ -120,7 +216,23 @@
.selectize-control.multi .selectize-input > div {
padding: 1px 3px;
margin: 0 3px 3px 0;
color: #333333;
cursor: pointer;
background: #e6e6e6;
border: 1px solid #cccccc;
}

.selectize-control.multi .selectize-input > div.active {
color: #ffffff;
background: #0088cc;
border: 1px solid #0077b3;
}

.selectize-control.multi .selectize-input.disabled > div,
.selectize-control.multi .selectize-input.disabled > div.active {
color: #474747;
background: #fafafa;
border: 1px solid #e0e0e0;
}

.selectize-input > input {
Expand Down Expand Up @@ -164,7 +276,7 @@
z-index: 2;
margin-top: -1px;
background: #ffffff;
border: 1px solid #cccccc;
border: 1px solid #d0d0d0;
border-top: 0 none;
-webkit-border-radius: 0 0 4px 4px;
-moz-border-radius: 0 0 4px 4px;
Expand Down Expand Up @@ -200,7 +312,7 @@
.selectize-dropdown .optgroup-header {
color: #999999;
cursor: default;
background: inherit;
background: #f8f8f8;
}

.selectize-dropdown .active {
Expand All @@ -213,7 +325,7 @@
}

.selectize-dropdown .create {
color: inherit;
color: #a0a0a0;
}

.selectize-dropdown-content {
Expand Down Expand Up @@ -259,7 +371,6 @@

.selectize-dropdown {
z-index: 1000;
padding: 5px 0;
margin: 2px 0 0 0;
border: 1px solid rgba(0, 0, 0, 0.2);
border-radius: 4px;
Expand Down Expand Up @@ -304,6 +415,14 @@
filter: progid:DXImageTransform.Microsoft.gradient(startColorstr='#ff0088cc', endColorstr='#ff0077b3', GradientType=0);
}

.selectize-dropdown-content {
padding: 5px 0;
}

.selectize-dropdown-header {
padding: 6px 10px;
}

.selectize-input {
-webkit-transition: border linear 0.2s, box-shadow linear 0.2s;
-moz-transition: border linear 0.2s, box-shadow linear 0.2s;
Expand Down Expand Up @@ -400,7 +519,7 @@
color: #333333;
text-shadow: none;
background-color: #f5f5f5;
*background-color: #ffffff;
*background-color: #e6e6e6;
background-image: -moz-linear-gradient(top, #ffffff, #e6e6e6);
background-image: -webkit-gradient(linear, 0 0, 0 100%, from(#ffffff), to(#e6e6e6));
background-image: -webkit-linear-gradient(top, #ffffff, #e6e6e6);
Expand Down
2 changes: 1 addition & 1 deletion dist/css/selectize.bootstrap2.min.css

Large diffs are not rendered by default.

Loading

0 comments on commit 3a76dcc

Please sign in to comment.