1 | <p align="center">
|
2 | <img src="http://simplaio.github.io/rucksack/logo.png" alt="rucksack logo" height="325" />
|
3 | </p>
|
4 |
|
5 | <p align="center">
|
6 | <a href="https://npmjs.org/package/rucksack-css"><img src="https://badge.fury.io/js/rucksack-css.svg" alt="NPM version" /></a>
|
7 | <a href="https://travis-ci.org/simplaio/rucksack"><img src="https://travis-ci.org/simplaio/rucksack.svg?branch=master" alt="Build satus" /></a>
|
8 | <a href="https://david-dm.org/simplaio/rucksack"><img src="https://david-dm.org/simplaio/rucksack.svg?theme=shields.io" alt="Dependency Status" /></a>
|
9 | </p>
|
10 |
|
11 | <br/>
|
12 |
|
13 | A little bag of CSS superpowers, built on [PostCSS][postcss].
|
14 |
|
15 | Rucksack makes CSS development less painful, with the features and shortcuts it should have come with out of the box.
|
16 |
|
17 | Made with ♥ by the folks at [Simpla][simpla].
|
18 |
|
19 | **Read the full docs at http://simplaio.github.io/rucksack**
|
20 |
|
21 | --
|
22 |
|
23 | ### Install
|
24 |
|
25 | ```sh
|
26 | $ npm install --save rucksack-css
|
27 | ```
|
28 |
|
29 | <br/>
|
30 |
|
31 | ### Usage
|
32 |
|
33 | ###### Gulp
|
34 | Use [gulp-rucksack][gulp-rucksack]
|
35 |
|
36 | ```js
|
37 | var gulp = require('gulp');
|
38 | var rucksack = require('gulp-rucksack');
|
39 |
|
40 | gulp.task('rucksack', function() {
|
41 | return gulp.src('src/style.css')
|
42 | .pipe(rucksack())
|
43 | .pipe(gulp.dest('style.css'));
|
44 | });
|
45 | ```
|
46 |
|
47 | ###### Grunt
|
48 | Use [grunt-rucksack][grunt-rucksack]
|
49 |
|
50 | ```js
|
51 | require('load-grunt-tasks')(grunt);
|
52 |
|
53 | grunt.initConfig({
|
54 | rucksack: {
|
55 | compile: {
|
56 | files: {
|
57 | 'style.css': 'src/style.css'
|
58 | }
|
59 | }
|
60 | }
|
61 | });
|
62 |
|
63 | grunt.registerTask('default', ['rucksack']);
|
64 | ```
|
65 |
|
66 | ###### Broccoli
|
67 | Use [broccoli-rucksack][broccoli-rucksack]
|
68 |
|
69 | ```js
|
70 | var rucksack = require('broccoli-rucksack');
|
71 | tree = rucksack(tree, [options]);
|
72 | ```
|
73 |
|
74 | ###### CLI
|
75 | Process CSS directly on the command line
|
76 |
|
77 | ```sh
|
78 | $ rucksack src/style.css style.css [options]
|
79 | ```
|
80 |
|
81 | ###### PostCSS
|
82 | Rucksack is built on PostCSS, and can be used as a PostCSS plugin.
|
83 |
|
84 | ```js
|
85 | var postcss = require('postcss'),
|
86 | rucksack = require('rucksack-css');
|
87 |
|
88 | postcss([ rucksack() ])
|
89 | .process(css, { from: 'src/style.css', to: 'style.css' })
|
90 | .then(function (result) {
|
91 | fs.writeFileSync('style.css', result.css);
|
92 | if ( result.map ) fs.writeFileSync('style.css.map', result.map);
|
93 | });
|
94 | ```
|
95 | See the [PostCSS Docs][postcss] for examples for your environment.
|
96 |
|
97 | ###### Stylus
|
98 | Rucksack can be used as a Stylus plugin with [PostStylus][poststylus]
|
99 |
|
100 | ```js
|
101 | stylus(css).use(poststylus('rucksack-css'))
|
102 | ```
|
103 |
|
104 | See the [PostStylus Docs][poststylus] for more examples for your environment.
|
105 |
|
106 | --
|
107 |
|
108 | ### Core Features
|
109 |
|
110 | _Automagical responsive typography_
|
111 | ```css
|
112 | .foo {
|
113 | font-size: responsive;
|
114 | }
|
115 | ```
|
116 | ![Responsive Type Demo][type-demo]
|
117 |
|
118 |
|
119 | _Shorthand syntax for positioning properties_
|
120 | ```css
|
121 | .foo {
|
122 | position: absolute 0 20px;
|
123 | }
|
124 | ```
|
125 |
|
126 | _Native clearfix_
|
127 | ```css
|
128 | .foo {
|
129 | clear: fix;
|
130 | }
|
131 | ```
|
132 |
|
133 | _Input pseudo-elements_
|
134 | ```css
|
135 | input[type="range"]::track {
|
136 | height: 2px;
|
137 | }
|
138 | ```
|
139 |
|
140 | _Hex shortcuts for RGBA_
|
141 | ```css
|
142 | .foo {
|
143 | color: rgba(#fff, 0.8);
|
144 | }
|
145 | ```
|
146 |
|
147 | _Shorthand `@font-face` src sets (becomes [FontSpring syntax][fontspring])_
|
148 | ```css
|
149 | @font-face {
|
150 | font-family: 'My Font';
|
151 | font-path: '/path/to/font/file';
|
152 | }
|
153 | ```
|
154 |
|
155 | _Whole library of modern easing functions_
|
156 | ```css
|
157 | .foo {
|
158 | transition: all 250ms ease-out-elastic;
|
159 | }
|
160 | ```
|
161 |
|
162 | _Powerful quantity pseudo-selectors_
|
163 | ```css
|
164 | li:at-least(4) {
|
165 | color: blue;
|
166 | }
|
167 |
|
168 | li:between(4,6) {
|
169 | color: red;
|
170 | }
|
171 | ```
|
172 |
|
173 | _CSS property aliases_
|
174 | ```css
|
175 | @alias {
|
176 | fs: font-size;
|
177 | bg: background;
|
178 | }
|
179 |
|
180 | .foo {
|
181 | fs: 16px;
|
182 | bg: #fff;
|
183 | }
|
184 | ```
|
185 |
|
186 | --
|
187 |
|
188 | ### Optional Extras
|
189 |
|
190 | ###### Autoprefixing
|
191 | Automatically apply vendor prefixes to relevant properties based on data from [CanIUse][caniuse].
|
192 |
|
193 |
|
194 | ###### Legacy Fallbacks
|
195 | Automatically insert legacy fallbacks for modern properties.
|
196 | ```css
|
197 | /* before */
|
198 | .foo {
|
199 | color: rgba(0,0,0,0.8);
|
200 | width: 50vmin;
|
201 | }
|
202 |
|
203 | .foo::before{
|
204 | opacity: 0.8;
|
205 | }
|
206 |
|
207 | /* after */
|
208 | .foo {
|
209 | color: rgb(0,0,0);
|
210 | color: rgba(0,0,0,0.8);
|
211 | width: 50vm;
|
212 | width: 50vmin;
|
213 | }
|
214 |
|
215 | .foo:before{
|
216 | opacity: 0.8;
|
217 | -ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)";
|
218 | }
|
219 | ```
|
220 |
|
221 | --
|
222 |
|
223 | **Read the full docs at http://simplaio.github.io/rucksack**
|
224 |
|
225 | --
|
226 |
|
227 | ### Options
|
228 | All features in Rucksack can be toggled on or off by passing options on initialization. By default all core features are set to `true`, and optional
|
229 | addons are set to `false`.
|
230 |
|
231 | Core features (default to `true`):
|
232 | - `responsiveType`
|
233 | - `shorthandPosition`
|
234 | - `quantityQueries`
|
235 | - `alias`
|
236 | - `inputPseudo`
|
237 | - `clearFix`
|
238 | - `fontPath`
|
239 | - `hexRGBA`
|
240 | - `easings`
|
241 |
|
242 | Addons (default to `false`):
|
243 | - `fallbacks`
|
244 | - `autoprefixer`
|
245 |
|
246 | ```js
|
247 | // Set in build tool, etc.
|
248 | .rucksack({
|
249 | // options
|
250 | })
|
251 | ```
|
252 | --
|
253 |
|
254 | ### License
|
255 |
|
256 | MIT © [Simpla][simpla]
|
257 |
|
258 | [simpla]: http://simpla.io
|
259 | [postcss]: https://github.com/postcss/postcss
|
260 | [gulp-rucksack]: https://github.com/simplaio/gulp-rucksack
|
261 | [grunt-rucksack]: https://github.com/simplaio/grunt-rucksack
|
262 | [broccoli-rucksack]: https://github.com/simplaio/broccoli-rucksack
|
263 | [poststylus]: https://github.com/seaneking/poststylus
|
264 | [type-demo]: http://simplaio.github.io/rucksack/img/type-demo.gif
|
265 | [fontspring]: http://blog.fontspring.com/2011/02/further-hardening-of-the-bulletproof-syntax/
|
266 | [caniuse]: http://caniuse.com
|
267 | [material-colors]: https://www.google.com/design/spec/style/color.html
|