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 install
to download all the required node modules - Run
gulp
to start watching your files for changes, orgulp thetaskname
to run a single task. See gulpfile.js for all available tasks.
* Optional but recommended
/source
= Source files. These are for dev use only./
= 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 Astrum (see Astrum Pattern Library below)
- Open & auto reload the styleguide in the browser
- Minify JS
- Minify images
- Build an svg sprite sheet
- Build an svg symbols file
You can add to, remove or modify any of these tasks.
If you need to change the sprite image path, see /source/svg-sprites/sprites.css
Bug with Chrome is that the svg file needs to be placed as the first thing in the body.
Placing svg file:
</body>
<svg xmlns="http://www.w3.org/2000/svg">
[CONTENT FROM SVG-SYMBOLS.SVG]
</svg>
Using one image from the file:
<svg class="icon-svg" width="43" height="43"><use xlink:href="#icon-close-x"></use></svg>
Where width and height = that one image's dimensions.
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').attr('aria-hidden','true').prependTo('body');
});
- Run the gulp task to see the library in-browser
- Add and edit components: Getting started with Astrum