diff --git a/.eslintignore b/.eslintignore new file mode 100644 index 0000000..76add87 --- /dev/null +++ b/.eslintignore @@ -0,0 +1,2 @@ +node_modules +dist \ No newline at end of file diff --git a/.npmignore b/.npmignore index 930b3fe..a560059 100644 --- a/.npmignore +++ b/.npmignore @@ -1,3 +1,14 @@ __fixtures__ +.babelrc +.codeclimate.yml +.editorconfig +.eslintrc.js +.snyk +.travis.yml +wallaby.js +webpack.config.js +*.log +.vscode/ __tests__ +coverage src diff --git a/README.md b/README.md index a99e160..f8b5c56 100644 --- a/README.md +++ b/README.md @@ -118,7 +118,7 @@ Because of the way Webpack works where "bootstrap" code must be run before any a it's imperative bootstrap and common chunks are generated and placed at the beginning, thereby allowing you to place dynamic chunks before your entry chunk which kickstarts app rendering. -In conjunction with your Webpack configuration (which we'll specify below), `flushChunks` solves these problems for you by consuming your Webpack compilation `stats` and generating strings and components you can embed in the final output rendered on the server. +In conjunction with your Webpack configuration (which we'll specify [below](#webpack-configuration)), `flushChunks` solves these problems for you by consuming your Webpack compilation `stats` and generating strings and components you can embed in the final output rendered on the server. ## Usage diff --git a/__tests__/__snapshots__/createApiWithCss.test.js.snap b/__tests__/__snapshots__/createApiWithCss.test.js.snap index 9879055..d08c21c 100644 --- a/__tests__/__snapshots__/createApiWithCss.test.js.snap +++ b/__tests__/__snapshots__/createApiWithCss.test.js.snap @@ -1,9 +1,7 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP exports[`createApiWithCss() generates js + style components, strings and arrays 1`] = ` - + - - " +" +" `; exports[`createApiWithCss() generates js + style components, strings and arrays 5`] = ` -" - - - " +" +" `; exports[`createApiWithCss() generates js + style components, strings and arrays 6`] = ` -" - - " +" `; exports[`createApiWithCss() generates js + style components, strings and arrays 7`] = ` @@ -81,9 +69,7 @@ Array [ `; exports[`createApiWithCss() uses files with extension "no_css.js" if available 1`] = ` - + - " -`; +exports[`createApiWithCss() uses files with extension "no_css.js" if available 4`] = `""`; -exports[`createApiWithCss() uses files with extension "no_css.js" if available 5`] = ` -" - - " -`; +exports[`createApiWithCss() uses files with extension "no_css.js" if available 5`] = `""`; exports[`createApiWithCss() uses files with extension "no_css.js" if available 6`] = ` -" - - " +"" `; exports[`createApiWithCss() uses files with extension "no_css.js" if available 7`] = ` diff --git a/src/createApiWithCss.js b/src/createApiWithCss.js index 3f8e2af..65a09f3 100644 --- a/src/createApiWithCss.js +++ b/src/createApiWithCss.js @@ -40,7 +40,7 @@ export default ( // 1) Use as React components using ReactDOM.renderToStaticMarkup, eg: // Js: () => ( - + {scripts.map((file, key) => ( ` ) - .join('\n')} - ` + .join('\n') }, styles: { toString: () => // lazy-loaded in case not used - ` - ${stylesheets + stylesheets .map(file => ``) - .join('\n')} - ` + .join('\n') }, // 3) Embed the raw css without needing to load another file. @@ -87,7 +83,7 @@ export default ( Css: () => (DEV ? api.Styles() - : + : ), css: { @@ -95,9 +91,7 @@ export default ( // lazy-loaded in case not used (DEV ? api.styles.toString() - : ` - - `) + : ``) }, // 4) names of files without publicPath or outputPath prefixed: