├── .babelrc ├── .editorconfig ├── .eslintrc.js ├── .flowconfig ├── .gitattributes ├── .gitignore ├── .npmignore ├── CHANGELOG.md ├── LICENSE ├── README.md ├── circle.yml ├── example ├── basic-with-router │ ├── package.json │ ├── src │ │ ├── components.js │ │ ├── index.js │ │ └── routes.js │ ├── template.js │ ├── test.js │ └── webpack.config.js ├── css-modules │ ├── .babelrc │ ├── .editorconfig │ ├── .gitignore │ ├── docker-compose.yml │ ├── package.json │ ├── scripts │ │ └── generate-nginx-conf.js │ ├── server.js │ ├── src │ │ ├── components │ │ │ ├── App.js │ │ │ ├── App.styl │ │ │ ├── favicon.ico │ │ │ └── react-logo.png │ │ ├── index.js │ │ ├── lib │ │ │ └── vars.styl │ │ └── routes.js │ ├── template.js │ ├── test.js │ ├── webpack.config.dev.js │ └── webpack.config.prod.js ├── deep-route-nesting │ ├── package.json │ ├── src │ │ ├── App.js │ │ ├── Products.js │ │ ├── index.js │ │ └── routes.js │ ├── template.js │ ├── test.js │ └── webpack.config.js ├── extract-css │ ├── .babelrc │ ├── .gitignore │ ├── package.json │ ├── server.js │ ├── src │ │ ├── components │ │ │ ├── App.css │ │ │ ├── App.js │ │ │ ├── favicon.ico │ │ │ └── react-logo.png │ │ └── index.js │ ├── template.js │ ├── test.js │ ├── webpack.config.dev.js │ └── webpack.config.prod.js ├── redux │ ├── .babelrc │ ├── .gitignore │ ├── .nvmrc │ ├── README.md │ ├── package.json │ ├── render-to-document-string.js │ ├── server.js │ ├── src │ │ ├── components │ │ │ ├── App.js │ │ │ ├── App.styl │ │ │ ├── Pages.js │ │ │ ├── Pages.styl │ │ │ ├── SignUp.js │ │ │ ├── SignUp.styl │ │ │ ├── banner.jpg │ │ │ ├── favicon.ico │ │ │ └── logo-full.svg │ │ ├── index.js │ │ ├── lib │ │ │ ├── components │ │ │ │ ├── Spinner.js │ │ │ │ ├── Spinner.styl │ │ │ │ └── index.js │ │ │ ├── expose-globals.js │ │ │ ├── fb-icon.svg │ │ │ ├── gplus-icon.svg │ │ │ ├── shared.styl │ │ │ ├── twitter-icon.svg │ │ │ └── vars.styl │ │ ├── modules │ │ │ ├── forms │ │ │ │ └── index.js │ │ │ └── things │ │ │ │ ├── index.js │ │ │ │ └── utils.js │ │ ├── redux │ │ │ ├── loggerMiddleware.js │ │ │ ├── promiseMiddleware.js │ │ │ ├── store.js │ │ │ └── types.js │ │ └── routes.js │ ├── template.js │ ├── test.js │ ├── webpack.config.dev.js │ └── webpack.config.prod.js ├── webpack-2 │ ├── .babelrc │ ├── .editorconfig │ ├── .eslintrc.js │ ├── .gitignore │ ├── README.md │ ├── client │ │ ├── components │ │ │ ├── App.js │ │ │ ├── App.styl │ │ │ ├── favicon.ico │ │ │ └── react-logo.png │ │ ├── index.js │ │ ├── lib │ │ │ └── vars.styl │ │ └── routes.js │ ├── package.json │ ├── server.js │ ├── template.js │ ├── test.js │ ├── webpack.config.dev.js │ └── webpack.config.prod.js ├── with-auth0 │ ├── README.md │ ├── package.json │ ├── src │ │ ├── App.js │ │ ├── AuthService.js │ │ ├── Products.js │ │ ├── index.js │ │ └── routes.js │ ├── template.js │ ├── test.js │ └── webpack.config.js ├── with-mock-auth │ ├── package.json │ ├── src │ │ ├── App.js │ │ ├── Products.js │ │ ├── index.js │ │ └── routes.js │ ├── template.js │ ├── test.js │ └── webpack.config.js ├── with-static-markup │ ├── package.json │ ├── src │ │ ├── components.js │ │ ├── index.js │ │ └── routes.js │ ├── template.js │ ├── test.js │ └── webpack.config.js └── with-template │ ├── package.json │ ├── src │ ├── components.js │ ├── index.js │ └── routes.js │ ├── template.js │ ├── test.js │ └── webpack.config.js ├── install_test_dependencies.sh ├── package.json ├── src ├── constants.js ├── index.js └── utils.js ├── test.js └── utils.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015", "react", "stage-1"] 3 | } 4 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | indent_style = space 5 | indent_size = 2 6 | end_of_line = lf 7 | charset = utf-8 8 | trim_trailing_whitespace = true 9 | insert_final_newline = true 10 | 11 | [*.md] 12 | trim_trailing_whitespace = false 13 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | extends: "zen", 3 | rules: { 4 | // Inferred types are fine for now. If flow can't infer it it will yell at 5 | // us. 6 | 'flowtype/require-parameter-type': [0], 7 | }, 8 | }; 9 | -------------------------------------------------------------------------------- /.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | .*/node_modules/babel-*. 3 | .*/node_modules/fbjs/*. 4 | .*/node_modules/y18n/test/locales/bad-locale.json 5 | .*/example/*. 6 | 7 | [include] 8 | 9 | [libs] 10 | 11 | [options] 12 | module.ignore_non_literal_requires=true 13 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | * text=auto 2 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | node_modules 3 | npm-debug.log 4 | dist 5 | public 6 | yarn.lock 7 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | src 2 | test.js 3 | -------------------------------------------------------------------------------- /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # 1.0.0 2 | 3 | This was a major overhaul and includes many improvements as well as some breaking changes: 4 | 5 | **Improvements** 6 | 7 | * Support for Redux ([#7](../../issues/7)) 8 | * Support for JSX templates ([#3](../../issues/3)) 9 | * All assets including templates are compiled through Webpack 10 | * Improved testing. Will help minimize breakage as new features are added in the future. 11 | 12 | **Breaking Changes** 13 | 14 | If you are upgrading to 1.x from 0.x you will need to make some changes. 15 | 16 | * The `src` option has now been replaced by `routes` 17 | * The `template` option is now required and uses JSX instead of string interpolation 18 | 19 | ## Upgrade Guide 20 | 21 | **v0.x** 22 | 23 | ```js 24 | new StaticSitePlugin({ 25 | src: 'app', // Chunk or file name 26 | bundle: '/app.js', // Path to JS bundle 27 | stylesheet: '/app.css', // Path to stylesheet (if any) 28 | }) 29 | ``` 30 | 31 | **v1.x** 32 | 33 | ```js 34 | new StaticSitePlugin({ 35 | routes: './src/routes.js', 36 | template: './template.js', 37 | }) 38 | ``` 39 | 40 | #### `src` replace with `routes` 41 | 42 | Now instead of specifying a `src` path you should specify the path to your routes configuration file as shown in the example above. No more chunk names, just the path to the file. Hopefully this will clear up confusion and allow for cleaner client-side code that does not need to account for whether or not it is being run in a browser or a compiler. 43 | 44 | #### `template` is mandatory 45 | 46 | To further simply the processing of static files the template option is now mandatory. Below you can find a working template file that you can copy in to your project to make the transition easier. Since almost every project needed to supply a custom template anyway this seems like the logical option. It also makes it no longer necessary to specify things like `stylesheet`, `bundle` or `favicon` in the plugin options. 47 | 48 | The file specified in the `template` option should now be a react component to be rendered with `React.renderToStaticMarkup`. See the example below: 49 | 50 | ```js 51 | import React from 'react'; 52 | 53 | const Html = (props) => ( 54 | 55 | 56 | 57 | 58 | 59 | {props.title} 60 |