A CSS starter project from Gravity Works.
- Install Node.js, Gulp.js and Node Version Manager if you don't have them already
- Copy all the files and folders in /startercss into your project's theme folder (don't forget the .gitignore) and navigate there in command line
- Run
nvm use* to make sure you're running the right version of node for this project - Run
npm installto download all the required node modules - Run
gulpto start watching your files for changes, orgulp thetasknameto run a single task. See gulpfile.js for all available tasks.
* Optional but recommended
/source = Source files. These are for dev use only.
/dist = Distribution files. These go on the server.
/pattern-library = See Astrum Pattern Library below
The Gulp tasks are configured to
- Compile Sass into minified CSS
- Create a styleguide with mdcss (see /src/styleguide/)
- Open & auto reload the mdcss styleguide in the browser
- Minify JS
- Build an svg sprite sheet
- Build an svg symbols file
- Minify images
You can add to, remove, or modify any of these tasks.
If you need to change the sprite image path, see /src/svg-sprites/sprites.css
Bug with Chrome is that the svg file needs to be placed as the first thing in the body. If you don't have access to change markup on the body then you can inject it with JS.
$.ajax({
url: "[YOURPATHHERE]/images/svg-symbols.svg",
context: document.body
}).done(function(data) {
$('svg',data).attr('class','visually-hidden').prependTo('body');
});- Run the gulp task to see the library in-browser
- Add and edit components: Getting started with Astrum