Skip to content

Commit

Permalink
Adding basic example
Browse files Browse the repository at this point in the history
  • Loading branch information
seantimm committed Mar 7, 2016
1 parent c8766cb commit a56fc09
Show file tree
Hide file tree
Showing 7 changed files with 53 additions and 1 deletion.
2 changes: 2 additions & 0 deletions .gitignore
Expand Up @@ -31,3 +31,5 @@ node_modules

# Optional REPL history
.node_repl_history

/dist
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,4 +1,4 @@
Copyright (c) 2016, {Esc} & {Return} w/ Sean Timm
Copyright (c) 2016, Sean Timm

Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
Expand Down
1 change: 1 addition & 0 deletions app/main.js
@@ -0,0 +1 @@
require('../includes/utility')
4 changes: 4 additions & 0 deletions includes/utility.js
@@ -0,0 +1,4 @@
function randomFunction() {
alert('It works');
}

12 changes: 12 additions & 0 deletions index.html
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title></title>
<script src="dist/main.bundle.js"></script>
<!--<script src="includes/utility.js"></script>-->
</head>
<body>
<button onclick="javascript:randomFunction()">Do it!</button>
</body>
</html>
15 changes: 15 additions & 0 deletions package.json
@@ -0,0 +1,15 @@
{
"name": "webpack-script-loader-example",
"version": "1.0.0",
"description": "Demonstrates basic use of webpack's script-loader",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "Sean Timm",
"license": "ISC",
"devDependencies": {
"script-loader": "^0.6.1",
"webpack": "^1.12.14"
}
}
18 changes: 18 additions & 0 deletions webpack.config.js
@@ -0,0 +1,18 @@
var path = require('path');

module.exports = {
entry: {
main: './app/main'
},
output: {
path: path.join(__dirname, 'dist'),
filename: '[name].bundle.js'
},
module: {
loaders: [{
test: /\.js$/,
include: path.join(__dirname, 'includes'),
loader: 'script'
}]
}
};

0 comments on commit a56fc09

Please sign in to comment.