diff --git a/examples/jade-loader/example.js b/examples/jade-loader/example.js new file mode 100755 index 0000000..13a1ca1 --- /dev/null +++ b/examples/jade-loader/example.js @@ -0,0 +1,4 @@ +require('./main.css'); +var h1 = document.createElement('h1'); +h1.innerHTML = 'Hello world!'; +document.body.appendChild(h1); \ No newline at end of file diff --git a/examples/jade-loader/favicon.ico b/examples/jade-loader/favicon.ico new file mode 100644 index 0000000..be74abd Binary files /dev/null and b/examples/jade-loader/favicon.ico differ diff --git a/examples/jade-loader/logo.png b/examples/jade-loader/logo.png new file mode 100644 index 0000000..d71b3d7 Binary files /dev/null and b/examples/jade-loader/logo.png differ diff --git a/examples/jade-loader/main.css b/examples/jade-loader/main.css new file mode 100644 index 0000000..232a2cd --- /dev/null +++ b/examples/jade-loader/main.css @@ -0,0 +1,3 @@ +body { + background: snow; +} \ No newline at end of file diff --git a/examples/jade-loader/template.jade b/examples/jade-loader/template.jade new file mode 100644 index 0000000..7c2c74a --- /dev/null +++ b/examples/jade-loader/template.jade @@ -0,0 +1,6 @@ +doctype html +html + head + title my jade template + body + h1 Hello from jade \ No newline at end of file diff --git a/examples/jade-loader/webpack.config.js b/examples/jade-loader/webpack.config.js new file mode 100755 index 0000000..a002fde --- /dev/null +++ b/examples/jade-loader/webpack.config.js @@ -0,0 +1,24 @@ +var HtmlWebpackPlugin = require('../..'); +var ExtractTextPlugin = require('extract-text-webpack-plugin'); +module.exports = { + entry: './example.js', + output: { + path: __dirname + '/dist', + publicPath: '', + filename: 'bundle.js' + }, + module: { + loaders: [ + { test: /\.css$/, loader: ExtractTextPlugin.extract('style-loader', 'css-loader') }, + { test: /\.png$/, loader: 'file-loader' } + ] + }, + plugins: [ + new HtmlWebpackPlugin({ + filename: 'jade-loader.html', + favicon: 'favicon.ico', + template: 'jade!./template.jade' + }), + new ExtractTextPlugin('styles.css') + ] +}; \ No newline at end of file diff --git a/index.js b/index.js index 950ec87..b2150c2 100644 --- a/index.js +++ b/index.js @@ -196,6 +196,7 @@ HtmlWebpackPlugin.prototype.evaluateCompilationResult = function(compilation, co try { newSource = vm.runInThisContext(source); } catch (e) { + // Log syntax error var syntaxError = require('syntax-error')(source); var errorMessage = 'Template compilation failed: ' + e + (syntaxError ? '\n' + syntaxError + '\n\n\n' + source.split('\n').map(function(row, i) { diff --git a/package.json b/package.json index 38c1dee..7fb197e 100644 --- a/package.json +++ b/package.json @@ -34,6 +34,7 @@ "extract-text-webpack-plugin": "^0.7.1", "file-loader": "^0.8.1", "html-loader": "^0.3.0", + "jade-loader": "^0.7.1", "jasmine-node": "^1.14.5", "jshint": "^2.7.0", "rimraf": "^2.3.3",