diff --git a/addons/links/README.md b/addons/links/README.md
index 9c34458a53cb..b2c6d63d53ff 100644
--- a/addons/links/README.md
+++ b/addons/links/README.md
@@ -43,7 +43,7 @@ linkTo('Toggle') // Links to the first story in the 'Toggle' kind
With that, you can link an event in a component to any story in the Storybook.
- First parameter is the the story kind name (what you named with `storiesOf`).
-- Second (optional) parameter is the story name (what you named with `.add`). If the second parameter is omitted, the link will point to the first story in the given kind.
+- Second (optional) parameter is the story name (what you named with `.add`). If the second parameter is omitted, the link will point to the first story in the given kind.
> You can also pass a function instead for any of above parameter. That function accepts arguments emitted by the event and it should return a string.
> Have a look at [PR86](https://github.com/kadirahq/react-storybook/pull/86) for more information.
diff --git a/app/react-native/package.json b/app/react-native/package.json
index d2d78b903fb1..5716932f1b31 100644
--- a/app/react-native/package.json
+++ b/app/react-native/package.json
@@ -53,6 +53,7 @@
"file-loader": "^0.11.1",
"find-cache-dir": "^1.0.0",
"global": "^4.3.2",
+ "html-webpack-plugin": "^2.30.1",
"json-loader": "^0.5.4",
"json5": "^0.5.1",
"postcss-loader": "^2.0.5",
diff --git a/app/react-native/src/preview/index.js b/app/react-native/src/preview/index.js
index ece4bd2319c3..2529253e331c 100644
--- a/app/react-native/src/preview/index.js
+++ b/app/react-native/src/preview/index.js
@@ -91,9 +91,11 @@ export default class Preview {
this._sendGetCurrentStory();
// finally return the preview component
- return params.onDeviceUI
- ?
- : ;
+ return params.onDeviceUI ? (
+
+ ) : (
+
+ );
};
}
diff --git a/app/react-native/src/server/config/webpack.config.js b/app/react-native/src/server/config/webpack.config.js
index ddd38a20d004..0e2f5c2ce09e 100644
--- a/app/react-native/src/server/config/webpack.config.js
+++ b/app/react-native/src/server/config/webpack.config.js
@@ -1,9 +1,10 @@
import path from 'path';
import webpack from 'webpack';
import CaseSensitivePathsPlugin from 'case-sensitive-paths-webpack-plugin';
+import HtmlWebpackPlugin from 'html-webpack-plugin';
import { OccurenceOrderPlugin, includePaths, excludePaths } from './utils';
-const config = {
+const getConfig = options => ({
devtool: '#cheap-module-eval-source-map',
entry: {
manager: [require.resolve('../../manager')],
@@ -14,6 +15,13 @@ const config = {
publicPath: '/',
},
plugins: [
+ new HtmlWebpackPlugin({
+ filename: 'index.html',
+ data: {
+ options: JSON.stringify(options),
+ },
+ template: require.resolve('../index.html.ejs'),
+ }),
new OccurenceOrderPlugin(),
new webpack.HotModuleReplacementPlugin(),
new CaseSensitivePathsPlugin(),
@@ -29,6 +37,6 @@ const config = {
},
],
},
-};
+});
-export default config;
+export default getConfig;
diff --git a/app/react-native/src/server/config/webpack.config.prod.js b/app/react-native/src/server/config/webpack.config.prod.js
index 841459f0c83f..b7c15794ef15 100644
--- a/app/react-native/src/server/config/webpack.config.prod.js
+++ b/app/react-native/src/server/config/webpack.config.prod.js
@@ -1,57 +1,69 @@
import path from 'path';
import webpack from 'webpack';
+import HtmlWebpackPlugin from 'html-webpack-plugin';
import { OccurenceOrderPlugin, includePaths, excludePaths } from './utils';
-const config = {
- bail: true,
- devtool: '#cheap-module-source-map',
- entry: {
- manager: [path.resolve(__dirname, '../../manager')],
- },
- output: {
- path: path.join(__dirname, 'dist'),
- filename: 'static/[name].bundle.js',
- // Here we set the publicPath to ''.
- // This allows us to deploy storybook into subpaths like GitHub pages.
- // This works with css and image loaders too.
- // This is working for storybook since, we don't use pushState urls and
- // relative URLs works always.
- publicPath: '/',
- },
- plugins: [
- new webpack.DefinePlugin({ 'process.env.NODE_ENV': '"production"' }),
- new webpack.optimize.DedupePlugin(),
- new webpack.optimize.UglifyJsPlugin({
- compress: {
- screw_ie8: true,
- warnings: false,
- },
- mangle: {
- screw_ie8: true,
- },
- output: {
- comments: false,
- screw_ie8: true,
- },
- }),
- ],
- module: {
- loaders: [
- {
- test: /\.jsx?$/,
- loader: require.resolve('babel-loader'),
- query: require('./babel.prod.js'), // eslint-disable-line
- include: includePaths,
- exclude: excludePaths,
- },
+const getConfig = options => {
+ const config = {
+ bail: true,
+ devtool: '#cheap-module-source-map',
+ entry: {
+ manager: [path.resolve(__dirname, '../../manager')],
+ },
+ output: {
+ path: path.join(__dirname, 'dist'),
+ filename: 'static/[name].bundle.js',
+ // Here we set the publicPath to ''.
+ // This allows us to deploy storybook into subpaths like GitHub pages.
+ // This works with css and image loaders too.
+ // This is working for storybook since, we don't use pushState urls and
+ // relative URLs works always.
+ publicPath: '/',
+ },
+ plugins: [
+ new HtmlWebpackPlugin({
+ filename: 'index.html',
+ data: {
+ options: JSON.stringify(options),
+ },
+ template: require.resolve('../index.html.ejs'),
+ }),
+ new webpack.DefinePlugin({ 'process.env.NODE_ENV': '"production"' }),
+ new webpack.optimize.DedupePlugin(),
+ new webpack.optimize.UglifyJsPlugin({
+ compress: {
+ screw_ie8: true,
+ warnings: false,
+ },
+ mangle: {
+ screw_ie8: true,
+ },
+ output: {
+ comments: false,
+ screw_ie8: true,
+ },
+ }),
],
- },
-};
+ module: {
+ loaders: [
+ {
+ test: /\.jsx?$/,
+ loader: require.resolve('babel-loader'),
+ query: require('./babel.prod.js'), // eslint-disable-line
+ include: includePaths,
+ exclude: excludePaths,
+ },
+ ],
+ },
+ };
-// Webpack 2 doesn't have a OccurenceOrderPlugin plugin in the production mode.
-// But webpack 1 has it. That's why we do this.
-if (OccurenceOrderPlugin) {
- config.plugins.unshift(new OccurenceOrderPlugin());
-}
+ // Webpack 2 doesn't have a OccurenceOrderPlugin plugin in the production mode.
+ // But webpack 1 has it. That's why we do this.
+ if (OccurenceOrderPlugin) {
+ config.plugins.unshift(new OccurenceOrderPlugin());
+ }
+
+ return config;
+};
-export default config;
+export default getConfig;
diff --git a/app/react-native/src/server/index.html.ejs b/app/react-native/src/server/index.html.ejs
new file mode 100644
index 000000000000..84b46693e476
--- /dev/null
+++ b/app/react-native/src/server/index.html.ejs
@@ -0,0 +1,34 @@
+
+
+
);
})
.addWithInfo(
'with some info',
'Use the [info addon](https://github.com/storybooks/storybook/tree/master/addons/info) with its painful API.',
- context =>
+ context => (
click the label in top right for info about "{context.story}"
+ )
)
.add(
'with new info',
withInfo(
'Use the [info addon](https://github.com/storybooks/storybook/tree/master/addons/info) with its new painless API.'
- )(context =>
+ )(context => (
{setOptions({ selectedAddonPanel: 'storybook/info/info-panel' })}
click the label in top right for info about "{context.story}"
- )
+ ))
)
.add(
'addons composition',
withInfo('see Notes panel for composition info')(
- withNotes('Composition: Info(Notes())')(context =>
+ withNotes('Composition: Info(Notes())')(context => (
{setOptions({ selectedAddonPanel: 'storybook/notes/panel' })}
click the label in top right for info about "{context.story}"