From 4007b33f728bd52c57e0288c7bc34e6e5a086c1d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sergej=20Mu=CC=88ller?= Date: Tue, 2 Aug 2016 21:11:53 +0200 Subject: [PATCH] v1.1.0 ##### Changes * Install `stylelint`, `gulp-stylelint`, `stylelint-config-standard` * Add `stylelint` rules at `.stylelintrc.yml` * Refactor `gulpfile.js` * Remove `gulp-uglify` module * Remove `gulp-scss-lint` module * Update `browser-sync` to v2.14.0 --- var/www/ip2country.info/.stylelintrc.yml | 7 ++++ var/www/ip2country.info/gulpfile.js | 53 +++++++++++------------- var/www/ip2country.info/package.json | 13 +++--- var/www/ip2country.info/scss/styles.scss | 1 + 4 files changed, 40 insertions(+), 34 deletions(-) create mode 100644 var/www/ip2country.info/.stylelintrc.yml diff --git a/var/www/ip2country.info/.stylelintrc.yml b/var/www/ip2country.info/.stylelintrc.yml new file mode 100644 index 0000000..70f3d65 --- /dev/null +++ b/var/www/ip2country.info/.stylelintrc.yml @@ -0,0 +1,7 @@ +extends: stylelint-config-standard +rules: + indentation: 4 + max-empty-lines: 2 + number-leading-zero: never + rule-non-nested-empty-line-before: null + declaration-empty-line-before: null diff --git a/var/www/ip2country.info/gulpfile.js b/var/www/ip2country.info/gulpfile.js index 8427b66..dc067db 100755 --- a/var/www/ip2country.info/gulpfile.js +++ b/var/www/ip2country.info/gulpfile.js @@ -11,11 +11,11 @@ const htmlmin = require('gulp-htmlmin'), cleanCSS = require('gulp-clean-css'), htmlhint = require('gulp-htmlhint'), - uglify = require('gulp-uglify'), multipipe = require('multipipe'), zopfli = require('gulp-zopfli'), config = require('./config.json'), sourcemaps = require('gulp-sourcemaps'), + stylelint = require('gulp-stylelint'), browserSync = require('browser-sync').create(); @@ -28,8 +28,9 @@ gulp.task( 'scss:build', () => { gulp.src( config.scss.source ), sourcemaps.init(), + stylelint( { reporters: [ { formatter: 'string', console: true } ] } ), sass(), - sourcemaps.write( '.', {includeContent: false, sourceRoot: config.scss.root} ), + sourcemaps.write( '.', { includeContent: false, sourceRoot: config.scss.root } ), gulp.dest( config.css.path ), browserSync.stream() @@ -52,35 +53,33 @@ gulp.task( 'html:hint', () => { ).on( 'error', notify.onError() ); } ); -gulp.task( 'html:inline', ['html:hint'], () => { +gulp.task( 'html:inline', [ 'html:hint' ], () => { return multipipe( gulp.src( config.html.source ), - inline( { base: '.', js: uglify, css: cleanCSS } ), + inline( { base: '.', css: cleanCSS } ), gulp.dest( config.dest.path ) ).on( 'error', notify.onError() ); } ); -gulp.task( 'html:minify', ['html:inline'], () => { +gulp.task( 'html:minify', [ 'html:inline' ], () => { return multipipe( gulp.src( config.dest.path + config.html.source ), - htmlmin( - { - collapseWhitespace: true, - removeRedundantAttributes: true, - removeOptionalTags: true, - removeAttributeQuotes: true, - collapseBooleanAttributes: true - } - ), + htmlmin( { + collapseWhitespace: true, + removeRedundantAttributes: true, + removeOptionalTags: true, + removeAttributeQuotes: true, + collapseBooleanAttributes: true + } ), gulp.dest( config.dest.path ) ).on( 'error', notify.onError() ); } ); -gulp.task( 'html:compress', ['scss:build', 'html:minify'], () => { +gulp.task( 'html:compress', [ 'scss:build', 'html:minify' ], () => { return multipipe( gulp.src( config.dest.path + config.html.source ), @@ -108,17 +107,15 @@ gulp.task( 'copy:files', () => { * browserSync task */ -gulp.task('serve', ['scss:build'], () => { - browserSync.init( - { - server: true, - port: 3001, - browser: 'google chrome' - } - ); - - gulp.watch( config.scss.source, ['scss:build'] ); - gulp.watch( config.html.source, ['html:hint'], browserSync.reload ); +gulp.task('serve', [ 'scss:build' ], () => { + browserSync.init( { + server: true, + port: 3001, + browser: 'google chrome' + } ); + + gulp.watch( config.scss.source, [ 'scss:build' ] ); + gulp.watch( config.html.source, [ 'html:hint' ], browserSync.reload ); }); @@ -126,11 +123,11 @@ gulp.task('serve', ['scss:build'], () => { * Build task */ -gulp.task( 'build', ['scss:build', 'html:compress', 'copy:files'] ); +gulp.task( 'build', [ 'scss:build', 'html:compress', 'copy:files' ] ); /* * Default task */ -gulp.task( 'default', ['serve'] ); +gulp.task( 'default', [ 'serve' ] ); diff --git a/var/www/ip2country.info/package.json b/var/www/ip2country.info/package.json index fe41369..639b3f7 100644 --- a/var/www/ip2country.info/package.json +++ b/var/www/ip2country.info/package.json @@ -1,12 +1,12 @@ { "name": "IP2Country", "description": "Node.js modules for IP 2 Country project", - "version": "1.0.0", - "last-update": "30.07.2016", + "version": "1.1.0", + "last-update": "02.08.2016", "private": true, "repository": "sergejmueller/ip2country.info", "devDependencies": { - "browser-sync": "^2.12.3", + "browser-sync": "^2.14.0", "gulp": "^3.9.1", "gulp-clean-css": "^2.0.6", "gulp-htmlhint": "^0.3.1", @@ -14,11 +14,12 @@ "gulp-inline": "^0.1.1", "gulp-notify": "^2.2.0", "gulp-sass": "^2.2.0", - "gulp-scss-lint": "^0.4.0", "gulp-sourcemaps": "^1.6.0", - "gulp-uglify": "^1.5.3", + "gulp-stylelint": "^3.0.0", "gulp-zopfli": "^1.0.0", - "multipipe": "^0.3.0" + "multipipe": "^0.3.0", + "stylelint": "^7.1.0", + "stylelint-config-standard": "^12.0.0" }, "scripts": { "test": "npm outdated" diff --git a/var/www/ip2country.info/scss/styles.scss b/var/www/ip2country.info/scss/styles.scss index d60dda3..5d2be4c 100644 --- a/var/www/ip2country.info/scss/styles.scss +++ b/var/www/ip2country.info/scss/styles.scss @@ -112,6 +112,7 @@ td { border-bottom-left-radius: 3px; } } + &:last-child { background: $color-secondary; border-left: 1px solid $color-secondary;