Skip to content

Commit 6036232

Browse files
Merge pull request #36 from raphaelfabeni/development
Development
2 parents 7090f30 + 7e14351 commit 6036232

File tree

3 files changed

+35
-19
lines changed

3 files changed

+35
-19
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -390,6 +390,9 @@ This loader differs from the other because we have to pass an attribute to it, a
390390
2. `yarn install` and `yarn serve`
391391
3. Open => `http://localhost:3000` (if it didn't open automatically)
392392
4. Make your magic contribution.
393+
4.1. Choose a special name for your loader (`loaders-name-you-want`) and add to `loaders.json`.
394+
4.2. Creates the example file inside the `examples` folder (uses the loader name you chose). You can copy one of the examples and make the necessary changes.
395+
4.3. Creates the `.sass` files. The first one inside `src` folder which is the root style file for the loader and it will import the other files. And the other one, inside `loaders` folder with the specific style for the loader (both must have the same name you chose - _loader-name-you-chose_).
393396
5. Run `yarn build` to create/update the dist files.
394397
6. Open a _PR_ with a new branch describing your changes. <o/
395398

loaders.json

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"loaders": [
3+
"css-loader",
4+
"loader-default",
5+
"loader-double",
6+
"loader-bar",
7+
"loader-bar-ping-pong",
8+
"loader-border",
9+
"loader-ball",
10+
"loader-clock",
11+
"loader-smartphone",
12+
"loader-curtain",
13+
"loader-music",
14+
"loader-pokeball",
15+
"loader-bouncing"
16+
]
17+
}

webpack.config.js

Lines changed: 15 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,22 @@
1-
var ExtractTextPlugin = require('extract-text-webpack-plugin')
2-
var LiveReloadPlugin = require('webpack-livereload-plugin')
3-
var SassLintPlugin = require('sasslint-webpack-plugin')
4-
var path = require('path')
1+
const ExtractTextPlugin = require('extract-text-webpack-plugin')
2+
const LiveReloadPlugin = require('webpack-livereload-plugin')
3+
const SassLintPlugin = require('sasslint-webpack-plugin')
4+
const path = require('path')
5+
const loaders = require('./loaders.json').loaders
6+
7+
function getEntries() {
8+
const tempObj = {}
9+
const tempLoaders = loaders.map(loader => {
10+
return tempObj[loader] = path.resolve(__dirname, 'src/' + loader + '.sass');
11+
});
12+
13+
return tempObj
14+
}
515

616
module.exports = {
717
context: __dirname,
818
name: 'css',
9-
entry: {
10-
'css-loader': path.resolve(__dirname, 'src/css-loader.sass'),
11-
'loader-default': path.resolve(__dirname, 'src/loader-default.sass'),
12-
'loader-double': path.resolve(__dirname, 'src/loader-double.sass'),
13-
'loader-bar': path.resolve(__dirname, 'src/loader-bar.sass'),
14-
'loader-bar-ping-pong': path.resolve(__dirname, 'src/loader-bar-ping-pong.sass'),
15-
'loader-border': path.resolve(__dirname, 'src/loader-border.sass'),
16-
'loader-ball': path.resolve(__dirname, 'src/loader-ball.sass'),
17-
'loader-clock': path.resolve(__dirname, 'src/loader-clock.sass'),
18-
'loader-smartphone': path.resolve(__dirname, 'src/loader-smartphone.sass'),
19-
'loader-curtain': path.resolve(__dirname, 'src/loader-curtain.sass'),
20-
'loader-music': path.resolve(__dirname, 'src/loader-music.sass'),
21-
'loader-pokeball': path.resolve(__dirname, 'src/loader-pokeball.sass'),
22-
'loader-bouncing': path.resolve(__dirname, 'src/loader-bouncing.sass')
23-
},
19+
entry: getEntries(),
2420
output: {
2521
path: path.resolve(__dirname, 'dist'),
2622
filename: '[name].js'

0 commit comments

Comments
 (0)