Skip to content

Commit

Permalink
- Code styling cleanup
Browse files Browse the repository at this point in the history
- Fixed test script
- Updated dependencies to latest versions
- Fixed font output file generation to be consistent in time with same hash(important for long time caching)
  • Loading branch information
mdudek committed Feb 9, 2017
1 parent cd6b1c3 commit 43dcc85
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 20 deletions.
8 changes: 6 additions & 2 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -97,12 +97,16 @@ module.exports = function (content) {
fontHeight: config.fontHeight || 1000, // Fixes conversion issues with small svgs
codepoints: config.codepoints,
templateOptions: {
baseClass: config.baseClass || 'icon',
baseSelector: config.baseClass || 'icon',
classPrefix: 'classPrefix' in config ? config.classPrefix : 'icon-'
},
dest: '',
writeFiles: false,
formatOptions: config.formatOptions || {}
formatOptions: config.formatOptions || {
ttf: {
ts: 0 // it's important to set timestamp to fixed value for ttf generation to have consistent output in time with same hash
}
}
};

// This originally was in the object notation itself.
Expand Down
15 changes: 8 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,17 @@
"author": "Ingwie Phoenix <[email protected]>",
"license": "MIT",
"dependencies": {
"glob": "^7.1.1",
"loader-utils": "^0.2.10",
"webfonts-generator": "^0.3.2",
"glob": "^6.0.2"
"webfonts-generator": "^0.4.0"
},
"devDependencies": {
"css-loader": "^0.15.1",
"file-loader": "^0.8.4",
"node-libs-browser": "^0.5.2",
"style-loader": "^0.12.3",
"css-loader": "^0.26.1",
"file-loader": "^0.10.0",
"node-libs-browser": "^2.0.0",
"style-loader": "^0.13.1",
"url-loader": "^0.5.6",
"webpack": "^1.9.11"
"webpack": "^2.2.1",
"webpack-dev-server": "^2.3.0"
}
}
21 changes: 13 additions & 8 deletions test/run.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
var path = require('path');
var WebpackDevServer = require('webpack-dev-server');
var webpack = require('webpack');

var config = require("./webpack.config.js");

var compiler = webpack(config);
var server = new WebpackDevServer(compiler, {
contentBase: path.resolve(__dirname),
publicPath: '/',
stats: {
colors: true
}
console.log('Compilation started...');
compiler.run(function() {
console.log('Completed.');
});

server.listen(8012);
// Test via web server
// var WebpackDevServer = require('webpack-dev-server');
// var server = new WebpackDevServer(compiler, {
// contentBase: path.resolve(__dirname),
// publicPath: '/',
// stats: {
// colors: true
// }
// });
// server.listen(8012);
6 changes: 3 additions & 3 deletions test/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ module.exports = {
entry: "./entry.js",
output: {
filename: "bundle.js",
path: path.join(__dirname, 'build')
path: path.resolve(__dirname, 'dist')
},
module: {
loaders: [
{
test: /\.font\.(js|json)$/,
loader: "style!css!" + require.resolve("../")
loader: "style-loader!css-loader!" + require.resolve("../")
}, {
test: /\.(woff|eot|ttf|svg)$/,
loader: "url"
loader: "url-loader"
}
]
}
Expand Down

0 comments on commit 43dcc85

Please sign in to comment.