Skip to content

Commit

Permalink
Concat all js files. Closes jackfranklin#14
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielperales committed Mar 19, 2017
1 parent 5ea4e42 commit 8636d4f
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 11 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
elm-stuff/
build/
node_modules/
dist/
**/*.DS_Store
2 changes: 0 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,7 @@
<link rel="stylesheet" type="text/css" href="/style.css" />
</head>
<body>
<script src="/vendor/highlight.pack.js"></script>
<script type="text/javascript" src="js/App.js"></script>
<script type="text/javascript" src="js/ports.js"></script>
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
Expand Down
3 changes: 3 additions & 0 deletions js/ports.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
var elm = require('../src/Main.elm');

var app = Elm.MyApp.fullscreen();

app.ports.newTitle.subscribe(function(value) {
if (value) {
document.title = value + ' | The Elm Playground'
Expand Down
11 changes: 11 additions & 0 deletions src/js/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
var Elm = require('../App.elm');

var app = Elm.MyApp.fullscreen();

app.ports.newTitle.subscribe(function(value) {
if (value) {
document.title = value + ' | The Elm Playground'
} else {
document.title = 'The Elm Playground'
}
});
18 changes: 10 additions & 8 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ const path = require('path');
const webpack = require('webpack');

module.exports = {
entry: './src/App.elm',
entry: [
'./src/App.elm',
'./src/js/app.js',
],
output: {
library: 'Elm',
path: path.join(__dirname, 'build'),
filename: 'js/App.js',
},
Expand All @@ -21,6 +23,9 @@ module.exports = {
}],
},
plugins: [
new webpack.ProvidePlugin({
hljs: path.join(__dirname, './vendor/highlight.pack.js'),
}),
new CopyWebpackPlugin([
{
from: 'style.css',
Expand All @@ -29,17 +34,14 @@ module.exports = {
from: 'img/*',
},
{
from: 'js/*',
},
{
from: 'vendor/**/*',
from: 'vendor/**/*.css',
},
{
from: 'content/**/*',
},
{
from: 'index.html',
}
])
},
]),
],
};

0 comments on commit 8636d4f

Please sign in to comment.