Skip to content

Commit d3efcb4

Browse files
committed
v0.1.0
1 parent aeb306e commit d3efcb4

File tree

3 files changed

+44
-28
lines changed

3 files changed

+44
-28
lines changed

.editorconfig

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
root = true
33

44
[*]
5-
indent_style = tab
5+
indent_style = space
66
indent_size = 4
77
end_of_line = lf
88
charset = utf-8
@@ -12,6 +12,12 @@ insert_final_newline = true
1212
[*.md]
1313
trim_trailing_whitespace = false
1414

15+
[package.json]
16+
indent_size = 2
17+
indent_style = space
18+
19+
trim_trailing_whitespace = false
20+
1521
[test/fixtures/*]
1622
insert_final_newline = false
1723
trim_trailing_whitespace = false

index.js

Lines changed: 34 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,31 +1,40 @@
11
var gulp = require('gulp'),
2-
elixir = require('laravel-elixir'),
3-
Task = elixir.Task,
4-
iconFont = require('gulp-iconfont'),
5-
iconFontCss = require('gulp-iconfont-css'),
6-
runTimestamp = Math.round(Date.now()/1000),
7-
fontName = 'icons';
2+
elixir = require('laravel-elixir'),
3+
Task = elixir.Task,
4+
iconFont = require('gulp-iconfont'),
5+
iconFontCss = require('gulp-iconfont-css'),
6+
runTimestamp = Math.round(Date.now()/1000),
7+
extend = require("xtend");
88

99

10-
elixir.extend('fonts', function(src, output) {
10+
elixir.extend('fonts', function(src, output, options) {
1111

12-
new Task('fonts', function() {
13-
return gulp.src(src)
14-
.pipe(iconFontCss({
15-
fontName: fontName,
16-
// path: elixir.config.assetsPath + '/' + elixir.config.css.sass.folder + '/_' + fontName + '.scss',
17-
targetPath: '../css/' + fontName + '.css',
18-
fontPath: '../fonts/'
19-
}))
20-
.pipe(iconFont({
21-
normalize: true,
22-
fontName: fontName, // required
23-
prependUnicode: false, // recommended option
24-
formats: ['ttf', 'eot', 'woff', 'woff2', 'svg'], // default, 'woff2' and 'svg' are available
25-
timestamp: runTimestamp // recommended to get consistent builds when watching files
26-
}))
27-
.pipe(gulp.dest(output))
28-
.pipe(new elixir.Notification('Fonts generated'));
29-
}).watch(src);
12+
options = options || {};
13+
var fontName = '_font_icons',
14+
elixirConfig = this.config,
15+
config = {
16+
font: {
17+
normalize: true,
18+
fontName: fontName, // required
19+
prependUnicode: false, // recommended option
20+
formats: ['ttf', 'eot', 'woff', 'woff2', 'svg'], // default, 'woff2' and 'svg' are available
21+
timestamp: runTimestamp // recommended to get consistent builds when watching files
22+
},
23+
css: {
24+
fontName: fontName,
25+
targetPath: '../../' + elixirConfig.assetsPath + '/' + elixirConfig.css.sass.folder + '/' + fontName + '.scss',
26+
fontPath: '../fonts/'
27+
}
28+
};
29+
30+
config = extend(config, options);
31+
console.log(config);
32+
33+
new Task('fonts', function() {
34+
return gulp.src(src)
35+
.pipe(iconFontCss(config.css))
36+
.pipe(iconFont(config.font))
37+
.pipe(gulp.dest(output));
38+
}).watch(src);
3039

3140
});

package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,9 @@
55
"main": "index.js",
66
"dependencies": {
77
"gulp": "^3.9.1",
8-
"gulp-iconfont": "^6.0.0",
9-
"gulp-iconfont-css": "^2.1.0"
8+
"gulp-iconfont": "6.0.0",
9+
"gulp-iconfont-css": "2.1.0",
10+
"xtend": "2.1.2"
1011
},
1112
"devDependencies": {},
1213
"scripts": {

0 commit comments

Comments
 (0)