Skip to content

Commit 9e7eacc

Browse files
committed
* Added WebPack configuration, RequireJS is dropped
* Updated Scss file structure * Added nvmrc file. Required node version is added, easier to use with nvm preinstalled. * Scss-lint task is added and now running on the fly * Resolved scss-lint issues in scss files, global scss-lint config edited * Support added for nesting selectors with parents (resolved issue with bem selectors, when writting scss code) * Added gitattributes file * Automated image optimization added * Added functionality, which checks if all dependencies are up to date. If not - gulp automatically installs them. * Added npmrc file (dependencies are automatically saved, even without defining flags, when installing and current version is defined in package.json) * eslintrc file is added * starter-template folder is removed * sass errors are not breaking gulp tasks * WebPack is running from gulp * Added gulp task cacheing for better task performance (faster repetitive tasks) * Added ability to make scss-lint errors silent
1 parent 470e7b5 commit 9e7eacc

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

69 files changed

+1033
-1184
lines changed

.babelrc

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"presets": ["es2015"]
3+
}
File renamed without changes.

.eslintrc

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
{
2+
"parser": "babel-eslint",
3+
"ecmaFeatures": {
4+
"objectLiteralDuplicateProperties": false,
5+
"modules": true,
6+
"jsx": true
7+
},
8+
"plugins": [
9+
"react",
10+
"lodash"
11+
],
12+
"rules": {
13+
"arrow-parens": 1,
14+
"brace-style": [
15+
2,
16+
"1tbs",
17+
{
18+
"allowSingleLine": true
19+
}
20+
],
21+
"camelcase": 0,
22+
"comma-dangle": 2,
23+
"curly": 2,
24+
"eqeqeq": 0,
25+
"jsx-quotes": 2,
26+
"new-cap": 0,
27+
"no-alert": 0,
28+
"no-cond-assign": 2,
29+
"no-console": 1,
30+
"no-constant-condition": 2,
31+
"no-control-regex": 2,
32+
"no-debugger": 2,
33+
"no-dupe-args": 2,
34+
"no-dupe-class-members": 2,
35+
"no-dupe-keys": 2,
36+
"no-duplicate-case": 2,
37+
"no-else-return": 1,
38+
"no-empty": 2,
39+
"no-empty-character-class": 2,
40+
"no-ex-assign": 2,
41+
"no-extra-boolean-cast": 2,
42+
"no-extra-parens": 0,
43+
"no-extra-semi": 0,
44+
"no-func-assign": 2,
45+
"no-inner-declarations": 2,
46+
"no-invalid-regexp": 2,
47+
"no-irregular-whitespace": 2,
48+
"no-label-var": 2,
49+
"no-negated-in-lhs": 2,
50+
"no-obj-calls": 2,
51+
"no-regex-spaces": 2,
52+
"no-shadow": 2,
53+
"no-sparse-arrays": 2,
54+
"no-undef": 2,
55+
"no-unneeded-ternary": 1,
56+
"no-underscore-dangle": 0,
57+
"no-unexpected-multiline": 2,
58+
"no-unreachable": 1,
59+
"no-unused-vars": 2,
60+
"no-use-before-define": 0,
61+
"quotes": [
62+
1,
63+
"single"
64+
],
65+
"semi": 2,
66+
"strict": 0,
67+
"use-isnan": 2,
68+
"valid-jsdoc": 0,
69+
"valid-typeof": 2,
70+
"react/display-name": 0,
71+
"react/jsx-boolean-value": 0,
72+
"react/jsx-no-undef": 1,
73+
"react/sort-prop-types": 1,
74+
"react/jsx-sort-props": 0,
75+
"react/jsx-uses-react": 1,
76+
"react/jsx-uses-vars": 1,
77+
"react/no-danger": 0,
78+
"react/no-did-mount-set-state": 1,
79+
"react/no-did-update-set-state": 1,
80+
"react/no-multi-comp": 1,
81+
"react/no-unknown-property": 1,
82+
"react/prop-types": 0,
83+
"react/react-in-jsx-scope": 1,
84+
"react/require-extension": 1,
85+
"react/self-closing-comp": 1,
86+
"react/sort-comp": 0,
87+
"react/wrap-multilines": 1,
88+
"devbridge-gt-v2/no-deprecated-lodash-func": 2,
89+
"lodash/callback-binding": 2,
90+
"lodash/no-extra-args": 2,
91+
"lodash/preferred-alias": 2,
92+
"lodash/unwrap": 1,
93+
"lodash/no-double-unwrap": 2,
94+
"lodash/collection-method-value": 2,
95+
"lodash/collection-return": 2,
96+
"lodash/no-single-chain": 2,
97+
"lodash/prefer-chain": 2
98+
},
99+
"env": {
100+
"browser": true,
101+
"node": true,
102+
"es6": true,
103+
"mocha": true
104+
},
105+
"globals": {
106+
"browser": true,
107+
"expect": true
108+
}
109+
}

.gitattributes

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
* text eol=lf
2+
*.cmd text eol=crlf
3+
4+
# binary
5+
*.ico binary
6+
*.xlsx binary
7+
*.xls binary
8+
*.zip binary
9+
*.png binary
10+
*.bmp binary
11+
*.jpg binary
12+
*.jpeg binary
13+
*.gif binary
14+
*.ttf binary
15+
*.eot binary
16+
*.otf binary
17+
*.woff binary
18+
*.woff2 binary
19+
20+
# Automatically normalize line endings for all text-based files
21+
# https://git-scm.com/docs/gitattributes#_end_of_line_conversion
22+
23+
* text=auto
24+
25+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
26+
27+
# For the following file types, normalize line endings to LF on
28+
# checkin and prevent conversion to CRLF when they are checked out
29+
# (this is required in order to prevent newline related issues like,
30+
# for example, after the build script is run)
31+
32+
.* text eol=lf
33+
*.css text eol=lf
34+
*.html text eol=lf
35+
*.js text eol=lf
36+
*.json text eol=lf
37+
*.md text eol=lf
38+
*.sh text eol=lf
39+
*.txt text eol=lf
40+
*.xml text eol=lf
41+
42+
# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
43+
44+
# Exclude the `.htaccess` file from GitHub's language statistics
45+
# https://github.com/github/linguist#using-gitattributes
46+
47+
dist/.htaccess linguist-vendored

.npmrc

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
save=true
2+
save-exact=true

.nvmrc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
"5.11"

.scss-lint.yml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
linters:
2+
Indentation:
3+
width: 4
4+
NestingDepth:
5+
ignore_parent_selectors: true
6+
DeclarationOrder:
7+
enabled: false
8+
TransitionAll:
9+
enabled: true

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
### 2.0.0 (July 13, 2016)
2+
3+
* Updated normalize.scss to v4.1.1
4+
* Added .nvmrc file for use with node version manager. Node 5.11 version is required.
5+
* Added .eslintrc file with eslint configuration + lodash, react plugins
File renamed without changes.

content/styles/site-styles.css

Lines changed: 4 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
File renamed without changes.

gulp/compile-scss/compile-scss.js

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
module.exports = function() {
2+
var gulp = require('gulp'),
3+
config = require('../gulp.config.js')(),
4+
plumber = require('gulp-plumber'),
5+
sass = require('gulp-sass'),
6+
bourbon = require('bourbon'),
7+
sourcemaps = require('gulp-sourcemaps'),
8+
neat = require('node-neat').includePaths,
9+
csso = require('gulp-csso');
10+
11+
var options = {
12+
includePaths: neat,
13+
outputStyle: 'nested', // 'compressed'
14+
sourceComments: false
15+
};
16+
17+
function swallowError(error) {
18+
// If you want details of the error in the console
19+
console.log('\x1b[36m', error.toString(), '\x1b[0m');
20+
this.emit('end');
21+
}
22+
23+
24+
return gulp.src(config.scss.src)
25+
.pipe(sourcemaps.init())
26+
.pipe(sass({
27+
outputStyle: 'expanded',
28+
sourceMap: true,
29+
noCache: false,
30+
includePaths: [].concat(neat, bourbon)
31+
}))
32+
.on('error', swallowError)
33+
.pipe(csso())
34+
.pipe(sourcemaps.write('./'))
35+
.pipe(gulp.dest(config.scss.cssFolder));
36+
};
37+
38+
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
var config = require('../gulp.config.js')();
2+
3+
module.exports = function () {
4+
var gulp = require('gulp'),
5+
plumber = require('gulp-plumber'),
6+
svg2png = require('gulp-svg2png'),
7+
svgSprite = require('gulp-svg-sprite');
8+
9+
10+
var svgConfig = {
11+
shape: {
12+
spacing: {
13+
padding: 0
14+
}
15+
},
16+
mode: {
17+
css: {
18+
bust: false,
19+
dest: './',
20+
// layout: 'vertical', 'horizontal', 'diagonal'
21+
sprite: config.svg.spriteFolder + 'sprite.svg',
22+
render: {
23+
scss: {
24+
dest: config.svg.scssMapFolder + '_svg-sprite-map.scss',
25+
template: config.svg.scssMapFolder + '_svg-sprite-template.scss'
26+
}
27+
}
28+
}
29+
}
30+
};
31+
32+
gulp.task('svg-sprite', function () {
33+
gulp.src(config.svg.sourceFolder + '*.svg')
34+
.pipe(plumber({
35+
errorHandler: function (err) {
36+
console.log(err);
37+
this.emit('end');
38+
}
39+
}))
40+
.pipe(svgSprite(svgConfig))
41+
.pipe(gulp.dest('./'));
42+
});
43+
44+
gulp.task('png-sprite', ['svg-sprite'], function () {
45+
gulp.src(config.svg.spriteFolder + '*.svg')
46+
.pipe(plumber({
47+
errorHandler: function () {
48+
console.log(err);
49+
this.emit('end');
50+
}
51+
}))
52+
.pipe(svg2png())
53+
.pipe(gulp.dest(config.svg.spriteFolder));
54+
});
55+
56+
if (config.svg.pngFallback) {
57+
gulp.start('png-sprite')
58+
} else {
59+
gulp.start('svg-sprite')
60+
}
61+
};
62+
63+
64+

gulp/gulp.config.js

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
module.exports = function () {
2+
var config = {
3+
scss: {
4+
src: [
5+
'./scss/**/*.scss',
6+
'!scss/**/*_scsslint_tmp*.scss' //ignores temporary scss-lint files
7+
],
8+
cssFolder: 'content/styles/'
9+
},
10+
svg: {
11+
sourceFolder: 'scss/assets/icons/',
12+
spriteFolder: 'content/styles/images/',
13+
scssMapFolder: 'scss/base/',
14+
pngFallback: false
15+
},
16+
optimize: {
17+
css: {},
18+
js: {},
19+
images: {
20+
src: 'content/images/originals/**/*.{png,gif,jpg,svg}',
21+
dest: 'content/images/',
22+
options: { // Target options
23+
optimizationLevel: 7,
24+
svgoPlugins: [{removeViewBox: false}],
25+
progessive: true,
26+
interlaced: true
27+
},
28+
}
29+
}
30+
};
31+
32+
return config;
33+
};
34+
35+
36+

gulp/watch-tasks/watch-all.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
module.exports = function () {
2+
var gulp = require('gulp'),
3+
config = require('../gulp.config.js')();
4+
5+
gulp.start(['check-deps', 'watch-scss', 'watch-svg']);
6+
};
7+

gulp/watch-tasks/watch-scss.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
module.exports = function () {
2+
var gulp = require('gulp'),
3+
config = require('../gulp.config.js')();
4+
gulp.watch(config.scss.src, ['compile-scss', 'scss-linting']);
5+
6+
};

gulp/watch-tasks/watch-svg.js

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
module.exports = function () {
2+
var gulp = require('gulp'),
3+
config = require('../gulp.config.js')();
4+
5+
return gulp.watch(config.svg.sourceFolder + '**/*.svg', function () {
6+
// Create SVG sprite
7+
require('gulp-task-loader')('gulp/create-svg-sprite');
8+
gulp.start('create-svg-sprite');
9+
});
10+
11+
};
12+

0 commit comments

Comments
 (0)