Skip to content

Commit

Permalink
* Added WebPack configuration, RequireJS is dropped
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
VaclovasV committed Jul 28, 2016
1 parent 470e7b5 commit 9e7eacc
Show file tree
Hide file tree
Showing 69 changed files with 1,033 additions and 1,184 deletions.
3 changes: 3 additions & 0 deletions .babelrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"presets": ["es2015"]
}
File renamed without changes.
109 changes: 109 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
{
"parser": "babel-eslint",
"ecmaFeatures": {
"objectLiteralDuplicateProperties": false,
"modules": true,
"jsx": true
},
"plugins": [
"react",
"lodash"
],
"rules": {
"arrow-parens": 1,
"brace-style": [
2,
"1tbs",
{
"allowSingleLine": true
}
],
"camelcase": 0,
"comma-dangle": 2,
"curly": 2,
"eqeqeq": 0,
"jsx-quotes": 2,
"new-cap": 0,
"no-alert": 0,
"no-cond-assign": 2,
"no-console": 1,
"no-constant-condition": 2,
"no-control-regex": 2,
"no-debugger": 2,
"no-dupe-args": 2,
"no-dupe-class-members": 2,
"no-dupe-keys": 2,
"no-duplicate-case": 2,
"no-else-return": 1,
"no-empty": 2,
"no-empty-character-class": 2,
"no-ex-assign": 2,
"no-extra-boolean-cast": 2,
"no-extra-parens": 0,
"no-extra-semi": 0,
"no-func-assign": 2,
"no-inner-declarations": 2,
"no-invalid-regexp": 2,
"no-irregular-whitespace": 2,
"no-label-var": 2,
"no-negated-in-lhs": 2,
"no-obj-calls": 2,
"no-regex-spaces": 2,
"no-shadow": 2,
"no-sparse-arrays": 2,
"no-undef": 2,
"no-unneeded-ternary": 1,
"no-underscore-dangle": 0,
"no-unexpected-multiline": 2,
"no-unreachable": 1,
"no-unused-vars": 2,
"no-use-before-define": 0,
"quotes": [
1,
"single"
],
"semi": 2,
"strict": 0,
"use-isnan": 2,
"valid-jsdoc": 0,
"valid-typeof": 2,
"react/display-name": 0,
"react/jsx-boolean-value": 0,
"react/jsx-no-undef": 1,
"react/sort-prop-types": 1,
"react/jsx-sort-props": 0,
"react/jsx-uses-react": 1,
"react/jsx-uses-vars": 1,
"react/no-danger": 0,
"react/no-did-mount-set-state": 1,
"react/no-did-update-set-state": 1,
"react/no-multi-comp": 1,
"react/no-unknown-property": 1,
"react/prop-types": 0,
"react/react-in-jsx-scope": 1,
"react/require-extension": 1,
"react/self-closing-comp": 1,
"react/sort-comp": 0,
"react/wrap-multilines": 1,
"devbridge-gt-v2/no-deprecated-lodash-func": 2,
"lodash/callback-binding": 2,
"lodash/no-extra-args": 2,
"lodash/preferred-alias": 2,
"lodash/unwrap": 1,
"lodash/no-double-unwrap": 2,
"lodash/collection-method-value": 2,
"lodash/collection-return": 2,
"lodash/no-single-chain": 2,
"lodash/prefer-chain": 2
},
"env": {
"browser": true,
"node": true,
"es6": true,
"mocha": true
},
"globals": {
"browser": true,
"expect": true
}
}
47 changes: 47 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
* text eol=lf
*.cmd text eol=crlf

# binary
*.ico binary
*.xlsx binary
*.xls binary
*.zip binary
*.png binary
*.bmp binary
*.jpg binary
*.jpeg binary
*.gif binary
*.ttf binary
*.eot binary
*.otf binary
*.woff binary
*.woff2 binary

# Automatically normalize line endings for all text-based files
# https://git-scm.com/docs/gitattributes#_end_of_line_conversion

* text=auto

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# For the following file types, normalize line endings to LF on
# checkin and prevent conversion to CRLF when they are checked out
# (this is required in order to prevent newline related issues like,
# for example, after the build script is run)

.* text eol=lf
*.css text eol=lf
*.html text eol=lf
*.js text eol=lf
*.json text eol=lf
*.md text eol=lf
*.sh text eol=lf
*.txt text eol=lf
*.xml text eol=lf

# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

# Exclude the `.htaccess` file from GitHub's language statistics
# https://github.com/github/linguist#using-gitattributes

dist/.htaccess linguist-vendored
2 changes: 2 additions & 0 deletions .npmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
save=true
save-exact=true
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"5.11"

This comment has been minimized.

Copy link
@kestutis-buivydas

kestutis-buivydas Jan 2, 2018

Contributor

Maybe we should update to latest stable version (8.9.3)?

9 changes: 9 additions & 0 deletions .scss-lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
linters:
Indentation:
width: 4
NestingDepth:
ignore_parent_selectors: true
DeclarationOrder:
enabled: false
TransitionAll:
enabled: true
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
### 2.0.0 (July 13, 2016)

* Updated normalize.scss to v4.1.1
* Added .nvmrc file for use with node version manager. Node 5.11 version is required.
* Added .eslintrc file with eslint configuration + lodash, react plugins
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
4 changes: 4 additions & 0 deletions content/styles/site-styles.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

File renamed without changes.
38 changes: 38 additions & 0 deletions gulp/compile-scss/compile-scss.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
module.exports = function() {
var gulp = require('gulp'),
config = require('../gulp.config.js')(),

This comment has been minimized.

Copy link
@andrius1

andrius1 Jan 2, 2018

Why vars are separated by commas? It does not optimise anything and makes code hard to refactor (two really annoying cases: if you need to move variable somewhere else or you delete the last one) AND can cause git conflicts in some cases.

plumber = require('gulp-plumber'),
sass = require('gulp-sass'),
bourbon = require('bourbon'),
sourcemaps = require('gulp-sourcemaps'),
neat = require('node-neat').includePaths,
csso = require('gulp-csso');

var options = {
includePaths: neat,
outputStyle: 'nested', // 'compressed'

This comment has been minimized.

Copy link
@andrius1

andrius1 Jan 2, 2018

A commented value for production? It could access an environment variable for example.

sourceComments: false
};

function swallowError(error) {
// If you want details of the error in the console
console.log('\x1b[36m', error.toString(), '\x1b[0m');
this.emit('end');
}


return gulp.src(config.scss.src)
.pipe(sourcemaps.init())
.pipe(sass({
outputStyle: 'expanded',

This comment has been minimized.

Copy link
@kestutis-buivydas

kestutis-buivydas Jan 2, 2018

Contributor

Shouldn't use options variable?

sourceMap: true,
noCache: false,
includePaths: [].concat(neat, bourbon)
}))
.on('error', swallowError)
.pipe(csso())
.pipe(sourcemaps.write('./'))
.pipe(gulp.dest(config.scss.cssFolder));
};


64 changes: 64 additions & 0 deletions gulp/create-svg-sprite/create-svg-sprite.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
var config = require('../gulp.config.js')();

module.exports = function () {
var gulp = require('gulp'),
plumber = require('gulp-plumber'),
svg2png = require('gulp-svg2png'),
svgSprite = require('gulp-svg-sprite');


var svgConfig = {
shape: {
spacing: {
padding: 0
}
},
mode: {
css: {
bust: false,
dest: './',
// layout: 'vertical', 'horizontal', 'diagonal'
sprite: config.svg.spriteFolder + 'sprite.svg',
render: {
scss: {
dest: config.svg.scssMapFolder + '_svg-sprite-map.scss',
template: config.svg.scssMapFolder + '_svg-sprite-template.scss'
}
}
}
}
};

gulp.task('svg-sprite', function () {
gulp.src(config.svg.sourceFolder + '*.svg')
.pipe(plumber({
errorHandler: function (err) {
console.log(err);
this.emit('end');
}
}))
.pipe(svgSprite(svgConfig))
.pipe(gulp.dest('./'));
});

gulp.task('png-sprite', ['svg-sprite'], function () {
gulp.src(config.svg.spriteFolder + '*.svg')
.pipe(plumber({
errorHandler: function () {
console.log(err);
this.emit('end');
}
}))
.pipe(svg2png())
.pipe(gulp.dest(config.svg.spriteFolder));
});

if (config.svg.pngFallback) {
gulp.start('png-sprite')
} else {
gulp.start('svg-sprite')
}
};



36 changes: 36 additions & 0 deletions gulp/gulp.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
module.exports = function () {
var config = {
scss: {
src: [
'./scss/**/*.scss',
'!scss/**/*_scsslint_tmp*.scss' //ignores temporary scss-lint files
],
cssFolder: 'content/styles/'
},
svg: {
sourceFolder: 'scss/assets/icons/',

This comment has been minimized.

Copy link
@kestutis-buivydas

kestutis-buivydas Jan 2, 2018

Contributor

Maybe should have same format as scss src?

spriteFolder: 'content/styles/images/',
scssMapFolder: 'scss/base/',
pngFallback: false
},
optimize: {
css: {},
js: {},
images: {
src: 'content/images/originals/**/*.{png,gif,jpg,svg}',
dest: 'content/images/',
options: { // Target options
optimizationLevel: 7,
svgoPlugins: [{removeViewBox: false}],
progessive: true,
interlaced: true
},
}
}
};

return config;
};



7 changes: 7 additions & 0 deletions gulp/watch-tasks/watch-all.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
module.exports = function () {
var gulp = require('gulp'),
config = require('../gulp.config.js')();

gulp.start(['check-deps', 'watch-scss', 'watch-svg']);
};

6 changes: 6 additions & 0 deletions gulp/watch-tasks/watch-scss.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
module.exports = function () {
var gulp = require('gulp'),
config = require('../gulp.config.js')();
gulp.watch(config.scss.src, ['compile-scss', 'scss-linting']);

};
12 changes: 12 additions & 0 deletions gulp/watch-tasks/watch-svg.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
module.exports = function () {
var gulp = require('gulp'),
config = require('../gulp.config.js')();

return gulp.watch(config.svg.sourceFolder + '**/*.svg', function () {
// Create SVG sprite
require('gulp-task-loader')('gulp/create-svg-sprite');
gulp.start('create-svg-sprite');
});

};

Loading

0 comments on commit 9e7eacc

Please sign in to comment.