From 5297675254c7f25d766cd4b50631cfcd50a131d9 Mon Sep 17 00:00:00 2001 From: Johannes Ewald Date: Mon, 20 Mar 2017 19:21:11 +0100 Subject: [PATCH] docs: add source map example --- examples/sourceMaps/index.html | 9 ++++++++ examples/sourceMaps/main.less | 6 +++++ examples/sourceMaps/other.less | 3 +++ examples/sourceMaps/package.json | 19 ++++++++++++++++ examples/sourceMaps/webpack.config.js | 32 +++++++++++++++++++++++++++ 5 files changed, 69 insertions(+) create mode 100644 examples/sourceMaps/index.html create mode 100644 examples/sourceMaps/main.less create mode 100644 examples/sourceMaps/other.less create mode 100644 examples/sourceMaps/package.json create mode 100644 examples/sourceMaps/webpack.config.js diff --git a/examples/sourceMaps/index.html b/examples/sourceMaps/index.html new file mode 100644 index 00000000..0d7009d8 --- /dev/null +++ b/examples/sourceMaps/index.html @@ -0,0 +1,9 @@ + + + + + + +
+ + diff --git a/examples/sourceMaps/main.less b/examples/sourceMaps/main.less new file mode 100644 index 00000000..16c390fd --- /dev/null +++ b/examples/sourceMaps/main.less @@ -0,0 +1,6 @@ +@import "./other.less"; + +.box:extend(.hotpink) { + width: 200px; + height: 200px; +} diff --git a/examples/sourceMaps/other.less b/examples/sourceMaps/other.less new file mode 100644 index 00000000..9cf35cd0 --- /dev/null +++ b/examples/sourceMaps/other.less @@ -0,0 +1,3 @@ +.hotpink { + background: hotpink; +} diff --git a/examples/sourceMaps/package.json b/examples/sourceMaps/package.json new file mode 100644 index 00000000..47755b76 --- /dev/null +++ b/examples/sourceMaps/package.json @@ -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" + } +} diff --git a/examples/sourceMaps/webpack.config.js b/examples/sourceMaps/webpack.config.js new file mode 100644 index 00000000..ddad1e13 --- /dev/null +++ b/examples/sourceMaps/webpack.config.js @@ -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, + }, +};