New react/redux project starter kit powered by gulp, webpack and friends.
git clone https://github.com/Nejik/nj-starter-kit.git new-project && cd new-project
npm i -g gulpjs/gulp#4.0 && npm i
npm start
npm start
npm run prod
PORT=9000 npm start
OPEN=true npm start
gulp clean
EJS used for building HTML
PostCSS used for building CSS
Babel and Webpack2 used for building JavaScript
For usual images such as background you don't need to do something special.
- vector icons (.svg) (preferred way)
-
If our icons shouldn't save their colors, and we want to style tem via css, we remove all fill/stroke styles from svg file and put icons in
src/img/sprites/svg/
and they will be processed todist/img/icons.svg
Then use it in html:
<svg class='icon'> <use xlink:href='img/icons.svg#down'></use> </svg>
-
If our icons should save their colors (logo for example), we should transfer all styles from
<style>
tag to attributes: example<path style="fill:red>
and put icons insrc/img/sprites/svgColored/
and they will be processed todist/img/iconsColored.svg
Then use it in html:
<svg class='icon'> <use xlink:href='img/iconsColored.svg#logo'></use> </svg>
Powered by gulp-svg-sprite
Difference between
icons.svg
andiconsColored.svg
is that iniconsColored.svg
styles are not cutted.
- raster icons (.png)
-
just put your raster icons in
src/img/sprites/
and use them in usual way (images automatically will be processed to sprites by postcss plugins).test:before { content:''; width:10px; height:15px; background-image:url('img/sprites/icon.png'); }
Powered by postcss-sprites
Difference between
icons.svg
andiconsColored.svg
is that iniconsColored.svg
styles are not cutted.
If for some reason we want to inline images, we have 2 ways:
- svg icons can be inlined and styled like this:
.up {
background: svg-load('img/arrow-up.svg', fill: #000, stroke: #fff);
&:hover {
background: svg-load('img/arrow-up.svg', fill: red, stroke: #fff);
}
}
Powered by postcss-inline-svg
- raster icons can be inlined like this:
.foobar {
background: inline('img/foobar.png');
}
Powered by postcss-assets
All images optimized by gulp-imagemin
MIT ©