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

Commit c5bd4f7

Browse files
committed
Build: Modularize build and add jsass-vars
Closes gh-89
1 parent 17fa2a8 commit c5bd4f7

27 files changed

+319
-248
lines changed

.gitignore

+1
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/

Gruntfile.js

+8-197
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

+5-9
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"
@@ -40,15 +40,12 @@
4040
"start": "grunt watch",
4141
"test": "grunt"
4242
},
43-
"dependencies": {
44-
"normalize.css": "3.0.3"
45-
},
43+
"dependencies": {},
4644
"devDependencies": {
4745
"browser-perf": "1.2.3",
4846
"chromedriver": "2.13.0",
4947
"commitplease": "2.0.0",
5048
"ejs-template": "0.1.0",
51-
"glob": "4.4.2",
5249
"grunt": "0.4.5",
5350
"grunt-autoprefixer": "2.1.0",
5451
"grunt-contrib-cssmin": "0.10.0",
@@ -59,14 +56,13 @@
5956
"grunt-csscomb": "3.0.0",
6057
"grunt-git-authors": "2.0.0",
6158
"grunt-html": "1.6.0",
62-
"grunt-htmllint": "0.2.7",
6359
"grunt-jscs": "0.6.2",
64-
"grunt-npmcopy": "0.1.0",
65-
"grunt-sass": "0.18.1",
60+
"grunt-sass": "0.17.0",
6661
"grunt-selenium-server": "0.1.2",
6762
"grunt-svgmin": "2.0.0",
6863
"grunt-svgstore": "0.5.0",
69-
"load-grunt-tasks": "3.1.0",
64+
"jsass-vars": "0.0.3",
65+
"load-grunt-config": "0.16.0",
7066
"perfjankie": "1.2.2"
7167
},
7268
"keywords": []

performance/frameworks/bootstrap.js

+1-1
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

-5
This file was deleted.

scss/atoms/typography/_functions.scss

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
* 1. font-size: em(14px);
1212
* 2. font-size: em(30px/14px);
1313
*/
14-
@function em($value, $context: map-get($root-font, font-size)) {
14+
@function em($value, $context: map-get($defaultFont, font-size)) {
1515
@return ($value / $context * 1em);
1616
}

scss/atoms/typography/_typography.scss

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
*/
66

77
@import
8-
"variables",
8+
"dist/chassis",
99
"functions",
1010
"mixins";
1111

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

1515
@media ( max-width: 800px ) {
1616
font-size: 16px;

scss/atoms/typography/_variables.scss

-22
This file was deleted.

scss/style.scss

+11-8
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
/*
2-
* ==========================================================================
3-
* CSS Chassis
4-
* ==========================================================================
5-
* This just adds normalize to the build see lint.scss for explanation.
6-
*/
1+
// ==========================================================================
2+
// CSS Chassis
3+
// ==========================================================================
74

85
@import
9-
"external/normalize.css/normalize.scss",
10-
"lint.scss";
6+
"_utilities/clearfix";
7+
8+
@import
9+
"atoms/icons/icons",
10+
"atoms/typography/typography";
11+
12+
@import
13+
"views/main";

scss/variables/chassis.js

+13
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
// This is just boiuler plate dont worry about it
2+
// This just supports loading in any enviroment
3+
(function ( root, factory ) {
4+
if ( typeof define === "function" && define.amd ) {
5+
define( [], factory );
6+
} else if ( typeof exports === "object" ) {
7+
module.exports = factory();
8+
} else {
9+
root.chassis = factory();
10+
}
11+
}( this, function () {
12+
return {};
13+
} ) );

0 commit comments

Comments
 (0)