Add jade-loader example
This commit is contained in:
parent
54002dd271
commit
ef42642f34
|
|
@ -0,0 +1,4 @@
|
|||
require('./main.css');
|
||||
var h1 = document.createElement('h1');
|
||||
h1.innerHTML = 'Hello world!';
|
||||
document.body.appendChild(h1);
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 766 B |
Binary file not shown.
|
After Width: | Height: | Size: 53 KiB |
|
|
@ -0,0 +1,3 @@
|
|||
body {
|
||||
background: snow;
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
doctype html
|
||||
html
|
||||
head
|
||||
title my jade template
|
||||
body
|
||||
h1 Hello from jade
|
||||
|
|
@ -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')
|
||||
]
|
||||
};
|
||||
1
index.js
1
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) {
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Reference in New Issue