Skip to content

Commit

Permalink
Merge pull request #17 from e-cloud/e-cloud-manifest-patch
Browse files Browse the repository at this point in the history
add a significant patch about manifest separating
  • Loading branch information
BohdanTkachenko authored Jul 6, 2016
2 parents e4b86af + 3edab4d commit 675c9a4
Show file tree
Hide file tree
Showing 10 changed files with 193 additions and 20,839 deletions.
25 changes: 25 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# http://editorconfig.org
root = true

[*]
indent_style = space
end_of_line = lf
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true

[*.js]
quote_type = single
curly_bracket_next_line = true
indent_brace_style = Allman
spaces_around_operators = true
spaces_around_brackets = inside
continuation_indent_size = 2

[*.html]
indent_size = 4

[{.travis.yml,bower.json,package.json}]
indent_style = space
indent_size = 2
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
example/dist
npm-debug.log
.idea
21 changes: 14 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,23 @@ Configuration of the plugin is simple. You instantiate the plugin with an array
Creating a 'catch-all' bucket is not necessary: anything which doesn't match one of the defined buckets will be left in
the original chunk.

Now, by separating the **manifest** info into a standalone chunk, vendor chunks(something like that) will stay the same with or without hashing unless you change their version.

### API
new SplitByPathPlugin(chunks, options);

- chunks - array of objects { name: string, path: string or array of strings }
- options - object, optional { ignore: string or array of strings }
- chunks - array of objects { name: string, path: string | string[] }
- options - object, optional {
ignore: string | string[],
ignoreChunks: string | string[],
manifest: string
}

```js
new SplitByPathPlugin([
{ name: 'c1': path: 'src/c1' },
{ name: 'vendor': path: path.join(__dirname, 'node_modules/')},
...,
chunkN
{ name: 'c1', path: 'src/c1' },
{ name: 'vendor', path: path.join(__dirname, 'node_modules/')},
...chunkN
], {
ignore: [
'path/to/ingore/file/or/dir1',
Expand Down Expand Up @@ -63,7 +68,9 @@ module.exports = {
name: 'vendor',
path: path.join(__dirname, 'node_modules')
}
])
], {
manifest: 'app-entry'
})
]
};
```
Expand Down
14 changes: 14 additions & 0 deletions example/app.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Title</title>
</head>
<body>
<h1>hello</h1>
<script src="./dist/manifest.js"></script>
<script src="./dist/vendor.js"></script>
<script src="./dist/styles.js"></script>
<script src="./dist/app.js"></script>
</body>
</html>
5 changes: 5 additions & 0 deletions example/js/test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
var React = require('react');
require('../css/app.css');

console.log('test.js loaded');
console.log(React);
Loading

0 comments on commit 675c9a4

Please sign in to comment.