Add grunt for production version

This commit is contained in:
Jordan Eldredge 2014-12-10 19:57:42 -08:00
parent 69659cbc7c
commit 54f38cc428
8 changed files with 101 additions and 4 deletions

2
.gitignore vendored
View file

@ -1,6 +1,4 @@
preview.png
**/production*
node_modules
# Files I use for local dev sometimes
llama-2.91.mp3

View file

@ -111,8 +111,7 @@
-
<a href='https://github.com/captbaritone/winamp2-js'>GitHub</a>
</p>
<script src="http://cdn.bootcss.com/jszip/2.4.0/jszip.min.js"></script>
<script src="js/jszip.2.4.0.min.js"></script>
<script src="js/browser.js"></script>
<script src="js/file-manager.js"></script>
<script src="js/visualizer.js"></script>
@ -143,5 +142,15 @@
document.getElementById('browser-compatibility').style.display = 'block';
}
</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),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-96948-15', 'jordaneldredge.com');
ga('send', 'pageview');
</script>
</body>
</html>

14
js/jszip.2.4.0.min.js vendored Normal file

File diff suppressed because one or more lines are too long

1
production/.gitignore vendored Normal file
View file

@ -0,0 +1 @@
node_modules

37
production/Gruntfile.js Normal file
View file

@ -0,0 +1,37 @@
module.exports = function(grunt) {
// 1. All configuration goes here
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
htmlrefs: {
dist: {
src: '../index.html',
dest: '../index.html',
options: {
includes: {
analytics: './analytics.js'
}
}
}
},
inline: {
dist: {
options:{
tag: '', // Inline all the things
uglify: true,
cssmin: true
},
src: [
'../css/winamp.css', // Inlines the cursor images
'../index.html'
]
}
}
});
grunt.loadNpmTasks('grunt-inline');
grunt.loadNpmTasks('grunt-htmlrefs');
grunt.registerTask('default', ['htmlrefs', 'inline']);
};

20
production/README.md Normal file
View file

@ -0,0 +1,20 @@
## TLDR;
You can ignore everything in this directory.
# Production
In production (http://jordaneldredge.com/projects/winamp.js/), I host a version
of the project that minifies and inlines many of the assets in improve load
time, and reduce load on my server. These files are used to build that version
production version of `index.html`.
If you have [Grunt](http://gruntjs.com) installed, you should be able to
generate the production build using these steps:
cd production/
npm install
grunt

9
production/analytics.js Normal file
View file

@ -0,0 +1,9 @@
<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),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-96948-15', 'jordaneldredge.com');
ga('send', 'pageview');
</script>

9
production/package.json Normal file
View file

@ -0,0 +1,9 @@
{
"name": "Winamp2-js",
"version": "0.1.0",
"devDependencies": {
"grunt": "^0.4.5",
"grunt-htmlrefs": "^0.5.0",
"grunt-inline": "^0.3.2"
}
}