Skip to content

Commit

Permalink
Merge pull request #174 from webpack-contrib/docs/source-map-example
Browse files Browse the repository at this point in the history
docs: add source map example
  • Loading branch information
jhnns authored Mar 20, 2017
2 parents e0d0006 + 5297675 commit 84c82fe
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 0 deletions.
9 changes: 9 additions & 0 deletions examples/sourceMaps/index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<!DOCTYPE>
<html>
<head>
<script src="/bundle.js"></script>
</head>
<body>
<div class="box"></div>
</body>
</html>
6 changes: 6 additions & 0 deletions examples/sourceMaps/main.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
@import "./other.less";

.box:extend(.hotpink) {
width: 200px;
height: 200px;
}
3 changes: 3 additions & 0 deletions examples/sourceMaps/other.less
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.hotpink {
background: hotpink;
}
19 changes: 19 additions & 0 deletions examples/sourceMaps/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"name": "source-maps-example",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "webpack-dev-server",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"css-loader": "^0.27.3",
"style-loader": "^0.14.1",
"less-loader": "^4.0.0",
"webpack": "^2.2.1",
"webpack-dev-server": "^2.4.2"
}
}
32 changes: 32 additions & 0 deletions examples/sourceMaps/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
module.exports = {
entry: require.resolve('./main.less'),
output: {
filename: 'bundle.js',
},
devtool: 'eval',
module: {
rules: [
{
test: /\.less$/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
sourceMap: true,
},
},
{
loader: require.resolve('../../dist'),
options: {
sourceMap: true,
},
},
],
},
],
},
devServer: {
inline: true,
},
};

0 comments on commit 84c82fe

Please sign in to comment.