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

Commit 0ae0e99

Browse files
MichaelArestadarschmitz
authored andcommitted
Build: Add sass and autoprefixer
Also adds build instructions to readme and build/watch tasks for builds Closes gh-42 Ref gh-33
1 parent 0ef42db commit 0ae0e99

File tree

12 files changed

+144
-3
lines changed

12 files changed

+144
-3
lines changed

.gitignore

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
# Files
22
npm-debug.log
33
icons/icons.svg
4-
4+
*.css.map
5+
style.css
56
# Folders
67
bower_components/
78
node_modules/
89
icons/svg-min/
10+
.sass-cache/

Gruntfile.js

+42-1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ grunt.loadNpmTasks( "grunt-html" );
55
grunt.loadNpmTasks( "grunt-jscs" );
66
grunt.loadNpmTasks( "grunt-svgmin" );
77
grunt.loadNpmTasks( "grunt-svgstore" );
8+
grunt.loadNpmTasks( "grunt-sass" );
9+
grunt.loadNpmTasks( "grunt-autoprefixer" );
810
grunt.loadNpmTasks( "grunt-contrib-watch" );
911

1012
grunt.initConfig({
@@ -60,8 +62,46 @@ grunt.initConfig({
6062
}
6163
}
6264
},
63-
65+
sass: {
66+
dist: {
67+
options: {
68+
sourceMap: true,
69+
outputStyle: "compressed"
70+
},
71+
files: [ {
72+
expand: true,
73+
cwd: "scss",
74+
src: [ "*.scss" ],
75+
dest: "",
76+
ext: ".css"
77+
} ]
78+
}
79+
},
80+
autoprefixer: {
81+
dist: {
82+
options: {
83+
map: true,
84+
browsers: [
85+
"> 1%",
86+
"last 2 versions",
87+
"safari >= 5.1",
88+
"ios >= 6.1",
89+
"android 2.3",
90+
"android >= 4",
91+
"ie >= 8"
92+
]
93+
},
94+
src: "*.css"
95+
}
96+
},
6497
watch: {
98+
sass: {
99+
files: [ "scss/**/*.scss" ],
100+
tasks: [ "sass", "autoprefixer" ],
101+
options: {
102+
spawn: false
103+
}
104+
},
65105
svg: {
66106
files: [ "svg-source/**/*.svg" ],
67107
tasks: [ "svgmin", "svgstore" ],
@@ -90,5 +130,6 @@ grunt.registerTask( "update-authors", function() {
90130
});
91131

92132
grunt.registerTask( "default", [ "jshint", "jscs" ] );
133+
grunt.registerTask( "build", [ "sass", "autoprefixer" ] );
93134

94135
};

README.md

+16
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,19 @@ Chassis is an attempt at creating open standards designed for CSS libraries, Jav
1111
## Project Collaboration and Interoperability
1212

1313
If you maintain a JavaScript library that has UI components, we'd love for you to join our efforts. We'd be happy to hear your feedback and work through updates of your project(s) to support CSS Framework. If you have the time and interest to help define the standards and improve on our implementation, that's even better! Check out the [contribution guidelines](https://github.com/jquery/css-chassis/blob/master/CONTRIBUTING.md) for more information.
14+
15+
16+
## Getting started
17+
18+
### Prerequisites
19+
20+
Node.js and npm should be installed. [[installer]](http://nodejs.org/download/)
21+
22+
### Building
23+
24+
Once you've cloned Chassis to your machine, run `npm install` and `grunt build` from the root Chassis directory.
25+
26+
```
27+
$ npm install
28+
$ grunt build
29+
```

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,14 @@
3939
"devDependencies": {
4040
"commitplease": "2.0.0",
4141
"grunt": "^0.4.5",
42+
"grunt-autoprefixer": "^2.1.0",
4243
"grunt-contrib-jshint": "0.10.0",
4344
"grunt-contrib-watch": "^0.6.1",
4445
"grunt-git-authors": "2.0.0",
4546
"grunt-jscs": "0.6.2",
4647
"grunt-svgmin": "^2.0.0",
47-
"grunt-svgstore": "^0.5.0"
48+
"grunt-svgstore": "^0.5.0",
49+
"grunt-sass": "^0.17.0"
4850
},
4951
"keywords": []
5052
}

scss/_utilities/_clearfix.scss

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// ==========================================================================
2+
// Clearfix
3+
// ==========================================================================
4+
5+
6+
@mixin clearfix() {
7+
&:before,
8+
&:after {
9+
content: "";
10+
display: table;
11+
}
12+
&:after {
13+
clear: both;
14+
}
15+
}
16+
17+
.clearfix {
18+
@include clearfix;
19+
}

scss/_utilities/_colors.scss

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// ==========================================================================
2+
// Colors
3+
// ==========================================================================

scss/atoms/icons/_icons.scss

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// ==========================================================================
2+
// Icons
3+
// ==========================================================================

scss/atoms/typography/_functions.scss

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// ==========================================================================
2+
// Typography functions
3+
// ==========================================================================
4+
5+
// em() function
6+
// Convert px to em in a readable fashion.
7+
// Examples:
8+
// 1. font-size: em(14px);
9+
// 2. font-size: em(30px/14px);
10+
@function em($value, $context: map-get($root-font, font-size)) {
11+
@return ($value / $context * 1em);
12+
}
+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// ==========================================================================
2+
// Typography
3+
// ==========================================================================
4+
5+
@import
6+
"variables",
7+
"functions";

scss/atoms/typography/_variables.scss

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// ==========================================================================
2+
// Typography variables
3+
// ==========================================================================
4+
5+
// Change these values when using custom fonts
6+
// For example, normal: 400;
7+
$normal: normal;
8+
$bold: bold;
9+
10+
$root-font:(
11+
color: #222,
12+
font-size: 20px,
13+
line-height: 1.5
14+
);
15+
16+
// Typefaces
17+
$monospace: "courier new", monospace;
18+
$serif: Georgia, "Times New Roman", Times, serif;
19+
$sans: Helvetica, Arial, sans-serif;

scss/style.scss

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// ==========================================================================
2+
// CSS Chassis
3+
// ==========================================================================
4+
5+
@import
6+
"_utilities/clearfix",
7+
"_utilities/colors";
8+
9+
@import
10+
"atoms/icons/icons",
11+
"atoms/typography/typography";
12+
13+
@import
14+
"views/main";

scss/views/main.scss

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
// ==========================================================================
2+
// Main
3+
// ==========================================================================

0 commit comments

Comments
 (0)