Skip to content

Instantly share code, notes, and snippets.

@BlakeWilliams
Created September 13, 2016 23:11
Show Gist options
  • Select an option

  • Save BlakeWilliams/00cdf5396a522d454db5b270ff948c2a to your computer and use it in GitHub Desktop.

Select an option

Save BlakeWilliams/00cdf5396a522d454db5b270ff948c2a to your computer and use it in GitHub Desktop.
diff --git a/brunch-config.js b/brunch-config.js
deleted file mode 100644
index 28a5d35..0000000
--- a/brunch-config.js
+++ /dev/null
@@ -1,58 +0,0 @@
-exports.config = {
- // See http://brunch.io/#documentation for docs.
- files: {
- javascripts: {
- joinTo: "js/app.js"
- },
- stylesheets: {
- joinTo: "css/app.css",
- order: {
- after: ["web/static/css/app.css"] // concat app.css last
- }
- },
- templates: {
- joinTo: "js/app.js"
- }
- },
-
- conventions: {
- assets: [
- /^(web\/static\/assets)/,
- /^(node_modules\/font-awesome[\\/])/
- ]
- },
-
- paths: {
- watched: [
- "web/static",
- "test/static"
- ],
-
- public: "priv/static"
- },
-
- plugins: {
- babel: {
- ignore: [/web\/static\/vendor/]
- },
-
- sass: {
- options: {
- includePaths: [
- require("bourbon").includePaths[0],
- require("bourbon-neat").includePaths[0],
- ],
- }
- }
- },
-
- modules: {
- autoRequire: {
- "js/app.js": ["web/static/js/app"]
- }
- },
-
- npm: {
- enabled: true
- }
-};
diff --git a/config/dev.exs b/config/dev.exs
index e936123..0e6312d 100644
--- a/config/dev.exs
+++ b/config/dev.exs
@@ -11,7 +11,7 @@ config :pluto, Pluto.Endpoint,
debug_errors: true,
code_reloader: true,
check_origin: false,
- watchers: [node: ["node_modules/brunch/bin/brunch", "watch", "--stdin",
+ watchers: [npm: ["run", "watch",
cd: Path.expand("../", __DIR__)]]
diff --git a/package.json b/package.json
index d0ada51..2312938 100644
--- a/package.json
+++ b/package.json
@@ -2,23 +2,24 @@
"repository": {},
"license": "MIT",
"scripts": {
- "deploy": "brunch build --production",
- "watch": "brunch watch --stdin"
+ "deploy": "webpack -p",
+ "watch": "webpack --watch-stdin --colors --progress"
},
"dependencies": {
"bourbon": "^4.2.7",
"bourbon-neat": "^1.8.0",
"font-awesome": "^4.6.3",
"phoenix": "file:deps/phoenix",
- "phoenix_html": "file:deps/phoenix_html",
- "sass-brunch": "^2.6.3"
+ "phoenix_html": "file:deps/phoenix_html"
},
"devDependencies": {
- "babel-brunch": "~6.0.0",
- "brunch": "2.7.4",
- "clean-css-brunch": "~2.0.0",
- "css-brunch": "~2.0.0",
- "javascript-brunch": "~2.0.0",
- "uglify-js-brunch": "~2.0.1"
+ "babel-core": "^6.5.2",
+ "babel-loader": "^6.2.5",
+ "babel-preset-es2015": "^6.14.0",
+ "copy-webpack-plugin": "^3.0.1",
+ "extract-text-webpack-plugin": "^1.0.1",
+ "raw-loader": "^0.5.1",
+ "sass-loader": "^4.0.2",
+ "webpack": "^1.13.2"
}
}
diff --git a/webpack.config.js b/webpack.config.js
new file mode 100644
index 0000000..6b571b4
--- /dev/null
+++ b/webpack.config.js
@@ -0,0 +1,57 @@
+const CopyWebpackPlugin = require('copy-webpack-plugin');
+const ExtractTextPlugin = require('extract-text-webpack-plugin');
+const extractCSS = new ExtractTextPlugin('css/app.css');
+
+module.exports = {
+ devtool: 'source-map',
+ entry: {
+ 'app': [
+ './web/static/css/app.scss',
+ './web/static/js/app.js'
+ ],
+ },
+
+ output: {
+ filename: 'js/app.js',
+ path: './priv/static',
+ },
+
+ resolve: {
+ modulesDirectories: [
+ 'node_modules',
+ __dirname + '/web/static/js'
+ ],
+ },
+
+ module: {
+ loaders: [
+ {
+ test: /\.js$/,
+ exclude: /node_modules/,
+ loader: 'babel',
+ query: {
+ presets: ['es2015'],
+ },
+ },
+ {
+ test: /\.scss$/,
+ loader: extractCSS.extract('raw!sass'),
+ },
+ ],
+ },
+
+ sassLoader: {
+ includePaths: [
+ require('bourbon').includePaths[0],
+ require('bourbon-neat').includePaths[0],
+ ],
+ },
+
+ plugins: [
+ extractCSS,
+ new CopyWebpackPlugin([
+ { from: 'web/static/assets', to: 'assets' },
+ { from: 'node_modules/font-awesome/fonts', to: 'fonts' },
+ ]),
+ ],
+}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment