forked from glebmachine/postcss-easysprites
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathgulpfile.js
More file actions
54 lines (45 loc) · 1.47 KB
/
gulpfile.js
File metadata and controls
54 lines (45 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
'use strict';
var gulp = require('gulp');
var postcss = require('gulp-postcss');
var easysprite = require('./index.js');
var rename = require('gulp-rename');
// linting
var jshint = require('gulp-jshint');
var jscs = require('gulp-jscs');
var stylish = require('gulp-jscs-stylish');
gulp.task('test', ['project:basic', 'lint'], function() {
var mocha = require('gulp-mocha');
return gulp.src('test/*.js', { read: false })
.pipe(mocha());
});
gulp.task('project:basic', function() {
gulp.src('./test/basic/input.css')
.pipe(postcss([
easysprite({
imagePath:'./test/basic/images',
spritePath: './test/basic/sprites',
}),
]))
.pipe(rename('output.css'))
.pipe(gulp.dest('./test/basic/'));
});
gulp.task('linting', function() {
return gulp.src('./index.js')
.pipe(jshint()) // hint (optional)
.pipe(jscs()) // enforce style guide
.pipe(stylish.combineWithHintResults()) // combine with jshint results
.pipe(jshint.reporter('jshint-stylish')); // use any jshint reporter to log hint
});
gulp.task('runtest', function() {
var mocha = require('gulp-mocha');
return gulp.src('test/basic.js', { read: false })
.pipe(mocha());
});
gulp.task('watch', function() {
gulp.watch([
'test/basic/input.css',
], ['project:basic']);
});
gulp.task('project', ['project:basic']);
gulp.task('default', ['watch']);
gulp.task('test', ['linting', 'runtest']);