Commit c8ecb0ed authored by Terion's avatar Terion

update icons task

parent dd503010
......@@ -8,11 +8,27 @@ fontelloConfig = 'src/img/icons/fontello.json'
# this eliminates bugs with font generation
gulp.task '_clear_config', ()->
config = JSON.parse(fs.readFileSync(fontelloConfig, 'utf8'))
config.glyphs = []
configExists = false
try
configExists = fs.lstatSync(fontelloConfig).isFile()
if configExists
config = JSON.parse(fs.readFileSync(fontelloConfig, 'utf8'))
config.glyphs = []
else
config = {glyphs: []}
fs.writeFileSync(fontelloConfig, JSON.stringify(config), 'utf8')
gulp.task '_icons-import-svg', (cb)->
try
fs.mkdirSync 'build/fonts'
try
fs.mkdirSync 'build/fonts/icons'
try
fs.mkdirSync 'build/css'
try
fs.mkdirSync 'build/css/icons'
importer.importSvg({
config: fontelloConfig
svgsrc: 'src/img/icons/'
......@@ -28,9 +44,9 @@ gulp.task '_icons_get', ['_icons-import-svg'], (cb)->
}, cb)
gulp.task 'icons', ['_clear_config', '_icons_get'], ->
# timeout to wait async disk write operation
# timeout to wait async disk write operation
setTimeout (->
gulp.src(['build/css/icons/icons.css'])
gulp.src(['build/css/icons/fontello.css'])
.pipe(replace('/font/', '/fonts/icons/'))
.pipe(gulp.dest('build/css'))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment