Skip to content
This repository was archived by the owner on Dec 11, 2021. It is now read-only.

Commit 69d46f2

Browse files
committed
Build: Modularize build and add jsass-vars
1 parent 64a51ac commit 69d46f2

29 files changed

+325
-238
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ style.css
66
# Folders
77
bower_components/
88
node_modules/
9+
external/
910
icons/svg-min/
1011
.sass-cache/
1112
dist/

.jshintrc

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
"trailing": true,
1313
"undef": true,
1414
"unused": true,
15-
15+
"globals": {
16+
"define": true
17+
},
1618
"node": true
1719
}

Gruntfile.js

Lines changed: 8 additions & 197 deletions
Original file line numberDiff line numberDiff line change
@@ -1,199 +1,10 @@
11
module.exports = function( grunt ) {
2-
require( "load-grunt-tasks" )( grunt );
3-
4-
var config = {
5-
htmllint: {
6-
dist: {
7-
options: {},
8-
src: [ "demos/*.html" ]
9-
}
10-
},
11-
autoprefixer: {
12-
dist: {
13-
options: {
14-
map: true,
15-
browsers: [
16-
"> 1%",
17-
"last 2 versions",
18-
"safari >= 5.1",
19-
"ios >= 6.1",
20-
"android 2.3",
21-
"android >= 4",
22-
"ie >= 8"
23-
]
24-
},
25-
src: "dist/css/*.css"
26-
}
27-
},
28-
csscomb: {
29-
dist: {
30-
files: {
31-
"dist/css/chassis.css": "dist/css/chassis.css"
32-
}
33-
},
34-
scss: {
35-
files: [ {
36-
expand: true,
37-
src: [ "scss/**/*.scss" ]
38-
} ]
39-
}
40-
},
41-
cssmin: {
42-
options: {
43-
report: "gzip",
44-
sourceMap: true
45-
},
46-
target: {
47-
files: {
48-
"dist/css/chassis.min.css": "dist/css/chassis.css"
49-
}
50-
}
51-
},
52-
csslint: {
53-
src: [ "dist/css/chassis.lint.css", "dist/css/chassis.lint.css", "demos/demos.css" ]
54-
},
55-
jscs: {
56-
all: [ "*.js", "performance/**/*.js" ]
57-
},
58-
jshint: {
59-
files: [ "*.js", "performance/**/*.js" ],
60-
options: {
61-
jshintrc: ".jshintrc"
62-
}
63-
},
64-
npmcopy: {
65-
options: {
66-
destPrefix: "external"
67-
},
68-
normalize: {
69-
files: {
70-
"normalize.css/LICENSE.md": "normalize.css/LICENSE.md",
71-
"normalize.css/normalize.scss": "normalize.css/normalize.css"
72-
}
73-
}
74-
},
75-
sass: {
76-
77-
// This is the same as lint below except including normalize.css
78-
dist: {
79-
options: {
80-
sourceMap: true,
81-
82-
// This actually does nested until libsass updates to support expanded
83-
outputStyle: "expanded"
84-
},
85-
files: {
86-
"dist/css/chassis.css": "scss/style.scss"
87-
}
88-
},
89-
90-
// This is everything except normalize.css which won't pass our lint settings
91-
lint: {
92-
options: {
93-
sourceMap: true,
94-
95-
// This actually does nested until libsass updates to support expanded
96-
outputStyle: "expanded"
97-
},
98-
files: {
99-
"dist/css/chassis.lint.css": "scss/lint.scss"
100-
}
101-
}
102-
},
103-
104-
// Minifies SVGs
105-
svgmin: {
106-
options: {
107-
plugins: [
108-
{
109-
removeViewBox: false
110-
},
111-
{
112-
removeUselessStrokeAndFill: false
113-
}
114-
]
115-
},
116-
dist: {
117-
files: [ {
118-
expand: true,
119-
cwd: "icons/svg-source",
120-
src: [ "*.svg" ],
121-
dest: "icons/svg-min/",
122-
ext: ".svg"
123-
} ]
124-
}
125-
},
126-
127-
// Combines SVGs into single file
128-
svgstore: {
129-
defaults: {
130-
options: {
131-
132-
// This will prefix each ID
133-
prefix: "icon-",
134-
135-
// Adds attributes to the resulting SVG
136-
svg: {
137-
viewBox: "0 0 24 24",
138-
xmlns: "http://www.w3.org/2000/svg"
139-
},
140-
cleanup: [ "style", "fill", "id" ]
141-
},
142-
files: {
143-
"icons/icons.svg": [ "icons/svg-min/*.svg" ]
144-
}
145-
}
146-
},
147-
watch: {
148-
sass: {
149-
files: [ "scss/**/*.scss" ],
150-
tasks: [ "build" ],
151-
options: {
152-
spawn: false
153-
}
154-
},
155-
svg: {
156-
files: [ "svg-source/**/*.svg" ],
157-
tasks: [ "svg" ],
158-
options: {
159-
spawn: false
160-
}
161-
}
162-
},
163-
"stop-selenium-server": {
164-
dev: {}
165-
}
166-
};
167-
168-
// This loads files in the options folder as task options
169-
// and builds an object based on their file names
170-
function loadConfig(path) {
171-
var glob = require( "glob" ),
172-
object = {},
173-
key;
174-
175-
glob.sync( "*", { cwd: path } ).forEach( function( option ) {
176-
key = option.replace( /\.js$/, "" );
177-
object[ key ] = require( path + option );
178-
});
179-
180-
return object;
181-
}
182-
183-
// We no combine the loaded task options with the ones defined in config above
184-
grunt.util._.extend( config, loadConfig( "./tasks/options/" ) );
185-
186-
grunt.initConfig( config );
187-
grunt.loadTasks( "tasks" );
188-
grunt.loadNpmTasks( "perfjankie" );
189-
grunt.registerTask( "default", [ "test" ] );
190-
grunt.registerTask( "test", [ "build", "jshint", "jscs", "csslint", "htmllint" ] );
191-
grunt.registerTask( "build", [ "svg", "sass", "csscomb", "cssmin" ] );
192-
grunt.registerTask( "perf", [
193-
"start-selenium-server",
194-
"connect:perf",
195-
"perfjankie",
196-
"stop-selenium-server"
197-
]);
198-
grunt.registerTask( "svg", [ "svgmin", "svgstore" ] );
2+
var path = require( "path" );
3+
require( "load-grunt-config" )( grunt, {
4+
configPath: [
5+
path.join( process.cwd(), "tasks/options" ),
6+
path.join( process.cwd(), "tasks" )
7+
],
8+
init: true
9+
} );
19910
};

package.json

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"name": "css-chassis",
33
"title": "Chassis",
44
"description": "An attempt at creating open standards designed for CSS libraries, JavaScript UI libraries, and web developers in general",
5-
"version": "0.0.1-pre",
5+
"version": "0.0.1",
66
"author": {
77
"name": "jQuery Foundation and other contributors",
88
"url": "https://github.com/jquery/css-chassis/blob/master/AUTHORS.txt"
@@ -48,7 +48,6 @@
4848
"chromedriver": "2.13.0",
4949
"commitplease": "2.0.0",
5050
"ejs-template": "0.1.0",
51-
"glob": "4.4.2",
5251
"grunt": "0.4.5",
5352
"grunt-autoprefixer": "2.1.0",
5453
"grunt-contrib-cssmin": "0.10.0",
@@ -59,14 +58,13 @@
5958
"grunt-csscomb": "3.0.0",
6059
"grunt-git-authors": "2.0.0",
6160
"grunt-html": "1.6.0",
62-
"grunt-htmllint": "0.2.7",
63-
"grunt-jscs": "0.6.2",
64-
"grunt-npmcopy": "0.1.0",
65-
"grunt-sass": "0.18.1",
61+
"grunt-jscs": "1.8.0",
62+
"grunt-sass": "0.17.0",
6663
"grunt-selenium-server": "0.1.2",
6764
"grunt-svgmin": "2.0.0",
6865
"grunt-svgstore": "0.5.0",
69-
"load-grunt-tasks": "3.1.0",
66+
"jsass-vars": "0.0.3",
67+
"load-grunt-config": "0.16.0",
7068
"perfjankie": "1.2.2"
7169
},
7270
"keywords": []

performance/component.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ var components = {
77
html = "";
88

99
function render( i ) {
10-
framework[ component ].variations[ keys[ i ] ].forEach(function( value ) {
10+
framework[ component ].variations[ keys[ i ] ].forEach( function( value ) {
1111
current[ keys[ i ] ] = value;
1212
if ( i < keys.length - 1 ) {
1313
render( i + 1 );
@@ -17,7 +17,7 @@ var components = {
1717
html = html + framework[ component ].generator.call( this, current );
1818
}
1919
}
20-
});
20+
} );
2121
}
2222
while ( currentCount < count ) {
2323
render( 0 );

performance/frameworks/bootstrap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ module.exports = {
2727
],
2828
icon: [
2929
false,
30-
"asterisk",
30+
"astrisk",
3131
"plus",
3232
"minus",
3333
"euro",

scss/_utilities/_colors.scss

Lines changed: 0 additions & 3 deletions
This file was deleted.

scss/atoms/typography/_functions.scss

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,6 @@
77
// Examples:
88
// 1. font-size: em(14px);
99
// 2. font-size: em(30px/14px);
10-
@function em($value, $context: map-get($root-font, font-size)) {
10+
@function em($value, $context: map-get($defaultFont, font-size)) {
1111
@return ($value / $context * 1em);
1212
}

scss/atoms/typography/_typography.scss

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,12 @@
33
// ==========================================================================
44

55
@import
6-
"variables",
6+
"dist/chassis",
77
"functions",
88
"mixins";
99

1010
body {
11-
font: $normal #{ map-get( $root-font, font-size ) }/1.5 $sans-serif;
11+
font: $normal #{ map-get( $defaultFont, font-size ) }/1.5 $sans;
1212

1313
@media ( max-width: 800px ) {
1414
font-size: 16px;

scss/atoms/typography/_variables.scss

Lines changed: 0 additions & 18 deletions
This file was deleted.

0 commit comments

Comments
 (0)