Skip to content

Commit

Permalink
Fix dependency watching (#1)
Browse files Browse the repository at this point in the history
* fix(postcss-plugin): Fix empty font creation

* fix(loader): watch resolved dependencies
  • Loading branch information
chastel authored and jantimon committed Sep 13, 2016
1 parent b707f3b commit ccbf05e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion lib/loader.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
// 'data:application/x-font-woff;charset=utf-8;base64,' + fontResult;
var createIconFont = require('./icons-to-woff.js');
var loaderUtils = require('loader-utils');
var path = require('path');

module.exports = function () {
if (this.cacheable) {
this.cacheable();
}
var callback = this.async();
var query = loaderUtils.parseQuery(this.query);
query.svgs.forEach((svg) => this.addDependency(svg));
query.svgs.forEach((svg) => this.addDependency(path.resolve(svg)));
createIconFont(query.svgs, query)
.then((result) => {
var url = '"data:application/x-font-woff;charset=utf-8;base64,' + result + '"';
Expand Down
2 changes: 1 addition & 1 deletion lib/postcss-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ module.exports = postcss.plugin('iconfont-webpack', function (opts) {
return getSvgPaths(root, opts.compilation.compiler, context)
.then(function (svgPaths) {
// Stop if the css file contains no `font-icon:url('..');` declarations
if (svgPaths.resolved.lenth === 0) {
if (svgPaths.resolved.length === 0) {
return;
}
// Generate a font icon name
Expand Down

0 comments on commit ccbf05e

Please sign in to comment.