Skip to content
This repository was archived by the owner on Feb 19, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,14 @@
"name": "spectacle-boilerplate",
"version": "1.0.1",
"description": "ReactJS Powered Presentation Framework",
"main": "lib/index.js",
"main": "dist/bundle.js",
"scripts": {
"clean": "rimraf dist",
"prebuild": "npm run clean",
"build": "cross-env NODE_ENV=production webpack --config webpack.config.production.js",
"clean": "rimraf dist",
"lint": "eslint --ext .js,.jsx .",
"deploy": "npm run clean & npm run build && surge -p .",
"start": "cross-env NODE_ENV=development node server.js"
"deploy": "npm run clean & npm run build && surge -p dist",
"start": "cross-env NODE_ENV=development webpack-dev-server --hot --port 3000 --content-base dist --config webpack.config.development.js"
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Self-explanatory, but swap out the custom express server and just use webpack dev server. Hot reloading and everything (to the best of my knowledge/testing) still works!

},
"author": "",
"license": "MIT",
Expand Down Expand Up @@ -44,19 +45,22 @@
"express": "^4.13.3",
"file-loader": "^0.9.0",
"html-loader": "^0.4.0",
"html-webpack-plugin": "~2.28.0",
"is-buffer": "^1.1.1",
"markdown-loader": "^0.1.7",
"node-libs-browser": "^0.5.3",
"object-assign": "~4.1.1",
"raw-loader": "^0.5.1",
"react-transform-catch-errors": "^1.0.0",
"react-transform-hmr": "^1.0.4",
"redbox-react": "^1.2.0",
"raw-loader": "^0.5.1",
"rimraf": "^2.4.4",
"style-loader": "^0.13.0",
"surge": "latest",
"url-loader": "^0.5.6",
"webpack": "2.2.0",
"webpack": "~2.4.1",
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Bumped the webpack version

"webpack-dev-middleware": "^1.8.4",
"webpack-dev-server": "~2.4.5",
"webpack-hot-middleware": "^2.13.0"
}
}
8 changes: 6 additions & 2 deletions index.html → public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,14 @@
<link href="https://fonts.googleapis.com/css?family=Montserrat:400,700" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/prism/1.3.0/themes/prism-tomorrow.css">
</head>

<body>
<div id="root"></div>

<script src="https://cdn.jsdelivr.net/prism/1.3.0/prism.js" type="text/javascript"></script>
<script src="https://cdn.jsdelivr.net/prism/1.3.0/components/prism-jsx.min.js" type="text/javascript"></script>
<script src="./dist/bundle.js"></script>

<!-- scripts will be injected here -->
</body>
</html>

</html>
31 changes: 0 additions & 31 deletions server.js

This file was deleted.

File renamed without changes.
10 changes: 5 additions & 5 deletions presentation/index.js → src/presentation/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@ require("spectacle/lib/themes/default/index.css");


const images = {
city: require("../assets/city.jpg"),
kat: require("../assets/kat.png"),
logo: require("../assets/formidable-logo.svg"),
markdown: require("../assets/markdown.png")
city: require("../../assets/city.jpg"),
kat: require("../../assets/kat.png"),
logo: require("../../assets/formidable-logo.svg"),
markdown: require("../../assets/markdown.png")
};

preloader(images);
Expand All @@ -53,7 +53,7 @@ export default class Presentation extends React.Component {
Spectacle Boilerplate
</Heading>
<Text margin="10px 0 0" textColor="tertiary" size={1} fit bold>
open the presentation/index.js file to get started
open the src/presentation/index.js file to get started
</Text>
</Slide>
<Slide transition={["fade"]} bgColor="tertiary">
Expand Down
43 changes: 43 additions & 0 deletions webpack.config.development.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/* eslint-disable */

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could improve this whole file by switching to webpack-merge or the like, but didn't want to get too crazy off of the bat

var path = require("path");
var webpack = require("webpack");
var assign = require("object-assign");

var config = require("./webpack.config");

config.devtool = 'cheap-module-eval-source-map';

config.output = assign(config.output, {
publicPath: "/"
});

config.plugins = config.plugins.concat([
new webpack.NoEmitOnErrorsPlugin()
]);

config.module.rules[0] = {
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't like that this requires the first item to always be the js|jsx loader. Open to other approaches...

test: /\.(js|jsx)$/,
exclude: /node_modules/,
loader: "babel-loader",
query: {
plugins: [
[
"react-transform", {
transforms: [{
transform: "react-transform-hmr",
imports: ["react"],
locals: ["module"]
}, {
transform: "react-transform-catch-errors",
imports: ["react", "redbox-react"]
}]
}
]
]
},
exclude: /node_modules/,
include: __dirname
};

module.exports = config;
67 changes: 25 additions & 42 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,69 +2,52 @@

var path = require("path");
var webpack = require("webpack");
var HtmlWebpackPlugin = require("html-webpack-plugin");

module.exports = {
devtool: "source-map",
entry: [
"webpack-hot-middleware/client",
"babel-polyfill",
"./index"
"./src/index"
],
output: {
path: path.join(__dirname, "dist"),
filename: "bundle.js",
publicPath: "/dist/"
publicPath: "./"
},
plugins: [
new webpack.HotModuleReplacementPlugin(),
new webpack.NoEmitOnErrorsPlugin()
new webpack.DefinePlugin({
"process.env": {
"NODE_ENV": JSON.stringify(process.env.NODE_ENV)
}
}),
new HtmlWebpackPlugin({
template: path.join(__dirname, "public/index.html")
})
],
resolve: {
alias: {
assets: path.join(__dirname, "assets")
}
},
module: {
loaders: [{
test: /\.md$/,
loader: "html-loader!markdown-loader?gfm=false"
}, {
rules: [{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
loader: "babel-loader",
query: {
plugins: [
[
"react-transform", {
transforms: [{
transform: "react-transform-hmr",
imports: ["react"],
locals: ["module"]
}, {
transform: "react-transform-catch-errors",
imports: ["react", "redbox-react"]
}]
}
]
]
},
exclude: /node_modules/,
include: __dirname
loader: "babel-loader"
}, {
test: /\.css$/,
loaders: ["style-loader", "raw-loader"],
loaders: ["style-loader", "css-loader"],
include: __dirname
}, {
test: /\.svg$/,
loader: "url-loader?limit=10000&mimetype=image/svg+xml",
include: path.join(__dirname, "assets")
}, {
test: /\.png$/,
loader: "url-loader?mimetype=image/png",
include: path.join(__dirname, "assets")
test: /\.md$/,
loader: "html-loader!markdown-loader?gfm=false"
}, {
test: /\.gif$/,
loader: "url-loader?mimetype=image/gif",
include: path.join(__dirname, "assets")
test: /\.(png|jpe?g|gif)$/,
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merged these loaders, not sure if the mimetype was doing a whole bunch. If so, I'll switch it back!

loader: "url-loader?limit=8192"
}, {
test: /\.jpg$/,
loader: "url-loader?mimetype=image/jpg",
include: path.join(__dirname, "assets")
test: /\.svg$/,
loader: "url-loader?limit=10000&mimetype=image/svg+xml"
}]
}
};
53 changes: 11 additions & 42 deletions webpack.config.production.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,45 +3,14 @@
var path = require("path");
var webpack = require("webpack");

module.exports = {
entry: [
"babel-polyfill",
"./index"
],
output: {
path: path.join(__dirname, "dist"),
filename: "bundle.js",
publicPath: "/dist/"
},
plugins: [
new webpack.DefinePlugin({
"process.env": {
"NODE_ENV": JSON.stringify("production")
}
}),
new webpack.optimize.UglifyJsPlugin({
compressor: {
warnings: false
}
})
],
module: {
loaders: [{
test: /\.md$/,
loader: "html-loader!markdown-loader?gfm=false"
}, {
test: /\.(js|jsx)$/,
exclude: /node_modules/,
loader: "babel-loader"
}, {
test: /\.css$/,
loader: "style-loader!css-loader"
}, {
test: /\.(png|jpg|gif)$/,
loader: "url-loader?limit=8192"
}, {
test: /\.svg$/,
loader: "url-loader?limit=10000&mimetype=image/svg+xml"
}]
}
};
var config = require('./webpack.config');

config.plugins = config.plugins.concat([
new webpack.optimize.UglifyJsPlugin({
compressor: {
warnings: false
}
})
]);

module.exports = config;
Loading