Skip to content

Commit f993d20

Browse files
committed
chore(gulpfile, css): Simplify build and comb css as part of the scss task.
Reduce the number of tasks by adding combing and linting to the scss task. Also generated new css.
1 parent 3417371 commit f993d20

File tree

6 files changed

+38
-67
lines changed

6 files changed

+38
-67
lines changed

.csscomb.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"always-semicolon": true,
44
"color-case": "lower",
55
"block-indent": " ",
6-
"color-shorthand": false,
6+
"color-shorthand": true,
77
"element-case": "lower",
88
"eof-newline": true,
99
"leading-zero": true,
@@ -22,5 +22,5 @@
2222
"strip-spaces": true,
2323
"tab-size": true,
2424
"unitless-zero": true,
25-
"vendor-prefix-align": true
25+
"vendor-prefix-align": false
2626
}

.csslintrc

-3
This file was deleted.

.stylelintrc

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
{
22
"extends": "stylelint-config-standard",
3-
3+
"rules": {
4+
"rule-non-nested-empty-line-before": "never"
5+
}
46
}

gulpfile.js

+32-50
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
var gulp = require('gulp')
66
var gulpStylelint = require('gulp-stylelint')
7-
var jshint = require('gulp-jshint')
87
var lodash = require('lodash')
98
var path = require('path')
109
var paths = require('./paths')
@@ -14,11 +13,14 @@ var standard = require('gulp-standard')
1413

1514
var karmaConfig = path.join(__dirname, 'karma.conf.js')
1615

17-
gulp.task('build-css', ['scss'], function () {
18-
var Comb = require('csscomb')
19-
var config = require('./.csscomb.json')
20-
var comb = new Comb(config)
21-
comb.processPath('./src/css/')
16+
gulp.task('css-lint', function () {
17+
return gulp.src(paths.css)
18+
.pipe(gulpStylelint({
19+
failAfterError: true,
20+
reporters: [
21+
{formatter: 'string', console: true}
22+
]
23+
}))
2224
})
2325

2426
gulp.task('clean', function () {
@@ -28,26 +30,15 @@ gulp.task('clean', function () {
2830
])
2931
})
3032

31-
gulp.task('default', ['clean:mobile'])
32-
3333
gulp.task('complexity', function (done) {
3434
function callback () {
3535
done()
3636
}
37-
plato.inspect(paths.lint, 'build/complexity', {title: 'prerender', recurse: true}, callback)
38-
})
3937

40-
gulp.task('csslint', function () {
41-
return gulp.src(paths.css)
42-
.pipe(gulpStylelint({
43-
failAfterError: true,
44-
reporters: [
45-
{formatter: 'string', console: true}
46-
]
47-
}))
38+
plato.inspect(paths.lint, 'build/complexity', {title: 'prerender', recurse: true}, callback)
4839
})
4940

50-
gulp.task('standard', function () {
41+
gulp.task('lint', function () {
5142
return gulp
5243
.src(paths.lint)
5344
.pipe(standard())
@@ -57,47 +48,25 @@ gulp.task('standard', function () {
5748
}))
5849
})
5950

60-
gulp.task('lint', function () {
61-
return gulp
62-
.src(paths.lint)
63-
.pipe(jshint('.jshintrc'))
64-
.pipe(jshint.reporter('default', {verbose: true}))
65-
.pipe(jshint.reporter('jshint-stylish'))
66-
.pipe(jshint.reporter('fail'))
67-
})
68-
69-
gulp.task('scss', ['scss-lint'], function () {
70-
var scss = require('gulp-sass')
51+
gulp.task('scss', function () {
52+
var autoprefixer = require('autoprefixer')
53+
var csscomb = require('gulp-csscomb')
7154
var postcss = require('gulp-postcss')
55+
var scss = require('gulp-sass')
56+
var scssLint = require('gulp-scss-lint')
57+
var scssLintStylish = require('gulp-scss-lint-stylish')
7258
var sourcemaps = require('gulp-sourcemaps')
73-
var autoprefixer = require('autoprefixer')
7459

7560
return gulp.src(paths.scss)
61+
.pipe(scssLint({customReport: scssLintStylish}))
7662
.pipe(scss())
7763
.pipe(sourcemaps.init())
7864
.pipe(postcss([autoprefixer({browsers: ['last 2 versions']})]))
7965
.pipe(sourcemaps.write('.'))
66+
.pipe(csscomb())
8067
.pipe(gulp.dest('./src/css'))
8168
})
8269

83-
gulp.task('scss-lint', function () {
84-
var scssLint = require('gulp-scss-lint')
85-
var scssLintStylish = require('gulp-scss-lint-stylish')
86-
return gulp.src('./src/scss/*.scss')
87-
.pipe(scssLint({customReport: scssLintStylish}))
88-
})
89-
90-
function testConfig (options) {
91-
var travisDefaultOptions = {
92-
browsers: ['Firefox'],
93-
reporters: ['dots', 'coverage', 'threshold']
94-
}
95-
96-
var travisOptions = process.env.TRAVIS && travisDefaultOptions
97-
98-
return lodash.assign(options, travisOptions)
99-
}
100-
10170
gulp.task('templatecache', function () {
10271
var templateCache = require('gulp-angular-templatecache')
10372
var htmlMin = require('gulp-htmlmin')
@@ -128,7 +97,7 @@ gulp.task('tdd', function (done) {
12897
server.start()
12998
})
13099

131-
gulp.task('test', ['standard', 'lint', 'csslint'], function (done) {
100+
gulp.task('test', ['lint', 'css-lint'], function (done) {
132101
var config = testConfig(
133102
{
134103
configFile: karmaConfig,
@@ -142,3 +111,16 @@ gulp.task('test', ['standard', 'lint', 'csslint'], function (done) {
142111
})
143112

144113
gulp.task('default', ['complexity', 'test'])
114+
gulp.task('css-build', ['scss', 'css-lint'])
115+
116+
function testConfig (options) {
117+
var travisDefaultOptions = {
118+
browsers: ['Firefox'],
119+
reporters: ['dots', 'coverage', 'threshold']
120+
}
121+
122+
var travisOptions = process.env.TRAVIS && travisDefaultOptions
123+
124+
return lodash.assign(options, travisOptions)
125+
}
126+

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"eslint": "^3.5.0",
3838
"gulp": "^3.9.1",
3939
"gulp-angular-templatecache": "^2.0.0",
40+
"gulp-csscomb": "^3.0.8",
4041
"gulp-csslint": "^1.0.0",
4142
"gulp-htmlmin": "^2.0.0",
4243
"gulp-jscs": "^4.0.0",

src/css/datetimepicker.css

-11
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)