Last active
November 24, 2016 03:17
-
-
Save svileng/87bd85b23586fe166342adcb9831874e to your computer and use it in GitHub Desktop.
Elixir LDN Examples
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
info "Building Phoenix static assets" | |
npm run build | |
mix phoenix.digest |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
plug Plug.Static, | |
at: "/", from: :my_app, gzip: if(Mix.env == :dev, do: false, else: true), | |
only: ~w(css fonts images js favicon.ico robots.txt) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "app", | |
"version": "0.0.0", | |
"private": true, | |
"scripts": { | |
"dev": "npm run clean:js && npm run webpack", | |
"webpack": "NODE_ENV=development webpack --color --display-chunks --display-modules", | |
"build:js": "NODE_ENV=production webpack --color", | |
"build": "npm run build:js", | |
"clean:js": "rm -rf priv/static/js/*" | |
}, | |
"devDependencies": { | |
"babel-loader": "6.2.4", | |
"babel-preset-es2015": "6.9.0", | |
"webpack": "1.13.1" | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var webpack = require("webpack") | |
var path = require("path") | |
var dev = process.env.NODE_ENV === "development" | |
var plugins = [ | |
new webpack.optimize.CommonsChunkPlugin({ | |
children: true, | |
async: true | |
}) | |
] | |
if (!dev) { | |
plugins = plugins.concat([ | |
new webpack.optimize.DedupePlugin(), | |
new webpack.optimize.UglifyJsPlugin({ | |
mangle: true, | |
compress: {warnings: false} | |
}) | |
]) | |
} | |
module.exports = { | |
devtool: dev ? "eval" : false, | |
watch: dev, | |
entry: { | |
app: path.resolve(__dirname, "web/static/js/app.js") | |
}, | |
output: { | |
path: path.resolve(__dirname, "priv/static/js"), | |
filename: "[name].js", | |
chunkFilename: dev ? "chunk.[id].js" : "chunk.[id]-[chunkhash].js", | |
publicPath: "/js/" | |
}, | |
module: { | |
loaders: [{ | |
test: /\.js$/, | |
include: path.resolve(__dirname, "web/static/js"), | |
loader: "babel", | |
query: { | |
cacheDirectory: true, | |
presets: ["es2015"] | |
} | |
}] | |
}, | |
plugins: plugins | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment