Add jade-loader example

This commit is contained in:
Jan Nicklas 2015-07-08 17:12:50 +02:00 committed by Jan Nicklas
parent 54002dd271
commit ef42642f34
8 changed files with 39 additions and 0 deletions

View File

@ -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

View File

@ -0,0 +1,3 @@
body {
background: snow;
}

View File

@ -0,0 +1,6 @@
doctype html
html
head
title my jade template
body
h1 Hello from jade

View File

@ -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')
]
};

View File

@ -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) {

View File

@ -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",