Skip to content

Commit d1523c9

Browse files
author
Florens Verschelde
committed
Update to gulp-task-maker 2.0
1 parent 11dbd5f commit d1523c9

37 files changed

+427
-397
lines changed

.eslintrc

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"env": {
3+
"es6": true,
4+
"node": true
5+
},
6+
"extends": ["eslint:recommended", "prettier"],
7+
"rules": {}
8+
}

.gitattributes

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
# Archive downloads: only keep gulp-tasks, gulpfile.js, package.json
1+
# Archive downloads: only keep tasks, gulpfile.js, package.json
22
/doc export-ignore
33
/test export-ignore
4+
/.eslintrc export-ignore
45
/.gitignore export-ignore
56
/.gitattributes export-ignore
6-
/gulpfile.test.js export-ignore
77
/LICENSE export-ignore
88
/README.md export-ignore

.gitignore

+6-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1-
# Test output
2-
test/gulp-tasks
3-
test/dist
1+
# Default sources
2+
/dist
3+
4+
# Test setup/output
5+
/test/tasks
6+
/test/dist
47

58
# This is a boilerplate: don't keep lockfiles
69
node_modules

README.md

+25-44
Original file line numberDiff line numberDiff line change
@@ -3,68 +3,49 @@ Configurable assets builder
33

44
A collection of configurable [gulp](http://gulpjs.com/) tasks we use to build front-end code, mostly for fully static or CMS-based website projects, using [gulp-task-maker](https://www.npmjs.com/package/gulp-task-maker).
55

6-
⚠ Requires Node.js 4 or later.
6+
⚠ Requires Node.js 6.5 or later.
77

88
Task list
99
---------
1010

11-
- [less](doc/less.md): compile Less stylesheets
12-
- [mincss](doc/mincss.md): concatenate and minify CSS
13-
- [minjs](doc/minjs.md): concatenate and minify JS code
14-
- [sass](doc/sass.md): compile Sass stylesheets
15-
- [svgsymbols](doc/svgsymbols.md): build SVG symbol sprites
11+
- [less](doc/less.md): compile Less stylesheets
12+
- [mincss](doc/mincss.md): concatenate and minify CSS
13+
- [minjs](doc/minjs.md): concatenate and minify JS code
14+
- [sass](doc/sass.md): compile Sass stylesheets
15+
- [svgsymbols](doc/svgsymbols.md): build SVG symbol sprites
1616

1717
Installation
1818
------------
1919

20-
### Simple installation
21-
22-
1. [Download a ZIP of this repo](https://github.com/gradientz/assets-builder/archive/master.zip) and unzip it in your projet directory.
23-
3. Change the main config in `gulpfile.js`.
24-
4. Finally, in a command prompt, go to your project dir and run: `npm install`.
25-
26-
### Custom installation
27-
28-
1. Install `gulp` and `gulp-task-maker` as devDependencies: `npm install -D gulp gulp-task-maker`.
29-
2. [Download a ZIP of this repo](https://github.com/gradientz/assets-builder/archive/master.zip) and copy the `gulp-tasks` directory or only the task scripts you want to ue.
30-
3. Write your own `gulpfile.js`, following the [gulp-task-maker documentation](https://github.com/fvsch/gulp-task-maker/blob/master/README.md).
20+
1. [Download a ZIP of this repo](https://github.com/gradientz/assets-builder/archive/master.zip) and unzip it in your projet directory.
21+
3. Change the main config in `gulpfile.js` as needed.
22+
4. Finally, in a command prompt, go to your project dir and run: `npm install`.
3123

3224
Usage
3325
-----
3426

35-
- `npm run build`: build assets once
36-
- `npm run watch`: run in the background and build assets when source files are changed
37-
38-
The first time you try to run a task, e.g. with `npm run build`, you might see an error that looks like this:
39-
40-
```
41-
[13:37:21] [gulp-task-maker] Errors in 'sass', 'minjs'
42-
43-
Install missing task dependencies with:
44-
npm install -D "gulp-autoprefixer@^3.1" "gulp-sass@^2.3" "gulp-uglify@^2.0"
45-
```
46-
47-
This is because task dependencies are not installed by default, but documented in the task’s `.json` file. This allows us to maintain as many tasks as we want in this repo, but not install dependencies we don’t use.
27+
- `npm run build`: build assets once
28+
- `npm run watch`: run in the background and build assets when source files are changed
4829

49-
Run the provided command (`npm install -D …`), then run `npm run build` again. You should see something like this:
30+
You should see something like this:
5031

5132
```
5233
$ npm run build
5334
54-
> assets-builder@4.0.0 build ~/my-project
35+
> assets-builder@5.0.0 build ~/my-project
5536
> gulp build
5637
5738
[13:38:12] Using gulpfile ~/my-project/gulpfile.js
58-
[13:38:12] Starting 'build-sass'...
59-
[13:38:12] Starting 'build-minjs'...
60-
[13:38:12] Starting 'build-svgsymbols'...
61-
[13:38:14] ./test/dist/ minjs.js 88.59 kB
62-
[13:38:14] ./test/dist/ sass.css 406 B
63-
[13:38:14] Finished 'build-minjs' after 2.33 s
64-
[13:38:14] ./test/dist/ svgsymbols.svg 9.31 kB
65-
[13:38:14] ./test/dist/ svgsymbols.svg.html 30.6 kB
66-
[13:38:14] Finished 'build-sass' after 2.37 s
67-
[13:38:14] Finished 'build-svgsymbols' after 2.34 s
68-
[13:38:14] Starting 'build'...
69-
[13:38:14] Finished 'build' after 6.65 μs
39+
[13:38:12] Starting 'build'...
40+
[13:38:12] Starting 'build_sass'...
41+
[13:38:12] Starting 'build_minjs'...
42+
[13:38:12] Starting 'build_svgsymbols'...
43+
[13:38:13] ./dist/ main.js 30 B
44+
[13:38:13] ./dist/ main.css 21 B
45+
[13:38:13] ./dist/ icons.svg 418 B
46+
[13:38:13] ./dist/ icons.svg.html 19.5 kB
47+
[13:38:13] Finished 'build_sass' after 168 ms
48+
[13:38:13] Finished 'build_minjs' after 168 ms
49+
[13:38:13] Finished 'build_svgsymbols' after 169 ms
50+
[13:38:13] Finished 'build' after 171 ms
7051
```

doc/less.md

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ require("gulp-task-maker").task("gulp-tasks/less.js", {
3030
// Should we minify with csso?
3131
minify: true,
3232

33+
// (Optional; pass a filename to use)
34+
// Should we concatenate all resulting files?
35+
concat: undefined,
36+
3337
// (Optional; defaults to "."; false to disable)
3438
// Where should we write sourcemaps (relative to "dest")
3539
sourcemaps: ".",

doc/mincss.md

+4
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,10 @@ require("gulp-task-maker").task("gulp-tasks/mincss.js", {
2929
// Should we minify with csso?
3030
minify: true,
3131

32+
// (Optional; pass a filename to use)
33+
// Should we concatenate all resulting files?
34+
concat: undefined,
35+
3236
// (Optional; defaults to "."; false to disable)
3337
// Where should we write sourcemaps (relative to "dest")
3438
sourcemaps: ".",

doc/minjs.md

+4
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,10 @@ require("gulp-task-maker").task("gulp-tasks/minjs.js", {
2828
// Should we minify with csso?
2929
minify: true,
3030

31+
// (Optional; pass a filename to use)
32+
// Should we concatenate all resulting files?
33+
concat: undefined,
34+
3135
// (Optional; defaults to "."; false to disable)
3236
// Where should we write sourcemaps (relative to "dest")
3337
sourcemaps: ".",

doc/sass.md

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ require("gulp-task-maker").task("gulp-tasks/sass.js", {
3030
// Should we minify with csso?
3131
minify: true,
3232

33+
// (Optional; pass a filename to use)
34+
// Should we concatenate all resulting files?
35+
concat: undefined,
36+
3337
// (Optional; defaults to "."; false to disable)
3438
// Where should we write sourcemaps (relative to "dest")
3539
sourcemaps: ".",

doc/svgsymbols.md

+9-5
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ require("gulp-task-maker").task("gulp-tasks/svgsymbols.js", {
2121
// Use true to watch the config.src files.
2222
watch: false,
2323

24+
// (Optional; defaults to true)
25+
// Should we minify with svgo?
26+
minify: true,
27+
2428
// (Optional; defaults to false)
2529
// Should we make a HTML demo page?
2630
demo: false,
@@ -30,12 +34,12 @@ require("gulp-task-maker").task("gulp-tasks/svgsymbols.js", {
3034
// "%f" is the cleaned-up original filename.
3135
id: "icon-%f",
3236

33-
// (Optional; defaults to the function shown below)
34-
// Function that cleans up file names to be used in the symbol’s id attribute
35-
slug: name => name.toLowerCase().replace(/[^a-z0-9]/g,""),
36-
3737
// (Optional) XML attributes added to the sprite's root element
3838
// e.g. {"aria-hidden": "true", height: 0, width: 0}
39-
svgAttrs: {}
39+
svgAttrs: {},
40+
41+
// (Optional; defaults to the function shown below)
42+
// Function that cleans up file names to be used in the symbol’s id attribute
43+
toSlug: name => name.toLowerCase().replace(/[^a-z0-9]/g,""),
4044
})
4145
```

gulp-tasks/less.js

-41
This file was deleted.

gulp-tasks/less.json

-7
This file was deleted.

gulp-tasks/mincss.js

-37
This file was deleted.

gulp-tasks/mincss.json

-6
This file was deleted.

gulp-tasks/minjs.js

-31
This file was deleted.

gulp-tasks/minjs.json

-5
This file was deleted.

gulp-tasks/sass.js

-42
This file was deleted.

gulp-tasks/sass.json

-7
This file was deleted.

0 commit comments

Comments
 (0)