Repository navigation
Expand file tree
/
Copy pathCssTask.js
More file actions
79 lines (63 loc) · 1.68 KB
/
Copy pathCssTask.js
File metadata and controls
79 lines (63 loc) · 1.68 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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
class CssTask extends Elixir.Task {
/**
* Create a new CssTask instance.
*
* @param {string} name
* @param {GulpPaths} paths
* @param {object|null} options
*/
constructor(name, paths, options) {
super(name, null, paths);
this.options = options;
}
/**
* Build the Gulp task.
*/
gulpTask() {
return (
gulp
.src(this.src.path)
.pipe(this.initSourceMaps())
.pipe(this.compile())
.on('error', this.onError())
.pipe(this.autoPrefix())
.pipe(this.concat())
.pipe(this.minify())
.on('error', this.onError())
.pipe(this.writeSourceMaps())
.pipe(this.saveAs(gulp))
.pipe(this.onSuccess())
);
}
/**
* Register file watchers.
*/
registerWatchers() {
this.watch(this.src.baseDir + Elixir.config.css[this.name].search)
.ignore(this.output.path);
}
/**
* Compile the CSS.
*/
compile() {
this.recordStep('Compiling ' + this.ucName());
let plugin = Elixir.Plugins[this.name] ||
Elixir.config.css[this.name].plugin;
return plugin(
this.options || Elixir.config.css[this.name].pluginOptions
);
}
/**
* Apply CSS auto-prefixing.
*/
autoPrefix() {
if (! Elixir.config.css.autoprefix.enabled) {
return this.stream();
}
this.recordStep('Autoprefixing CSS');
return Elixir.Plugins.autoprefixer(
Elixir.config.css.autoprefix.options
);
}
}
export default CssTask;