diff --git a/.gitignore b/.gitignore index abc749bf3..a57d967f7 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ assets/components/ assets/javascript/vendor/ assets/javascript/foundation.js assets/javascript/custom/demosite.js +packaged/ diff --git a/Gruntfile.js b/Gruntfile.js index f164ea897..96561a4d8 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -5,6 +5,29 @@ module.exports = function (grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), + // Compress and zip only the files required for deployment to the server. Exclude all dev dependencies. + compress: { + main: { + options: { + archive: 'packaged/<%= pkg.name %>.zip' + }, + expand: true, + cwd: '.', + src: [ + '**/*', + '!**/node_modules/**', + '!**/components/**', + '!**/scss/**', + '!**/bower.json', + '!**/Gruntfile.js', + '!**/package.json', + '!**/composer.json', + '!**/composer.lock', + '!**/codesniffer.ruleset.xml' + ], + dest: '<%= pkg.name %>' + }, + }, sass: { options: { @@ -153,7 +176,9 @@ module.exports = function (grunt) { grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-string-replace'); + grunt.loadNpmTasks('grunt-contrib-compress'); + grunt.registerTask('package', ['compress:main']); grunt.registerTask('build', ['copy', 'string-replace:fontawesome', 'sass', 'concat', 'uglify']); grunt.registerTask('default', ['watch']); -}; \ No newline at end of file +}; diff --git a/README.md b/README.md index 501f9a043..db0781df3 100755 --- a/README.md +++ b/README.md @@ -45,7 +45,15 @@ $ npm run watch $ npm run build ``` -And you're set! +### 4. Compress all files required for deployment: +It is not recommended that you deploy the entire theme folder to your webserver. There is no danger associated with doing this, but it is a waste of disk space and bandwidth. The node_modules and components for instance is only required during theme development. + +By executing the command below, you will compress only the files that are required for deployment. The file will be available as a .zip inside the folder named '/package'. + +```bash +$ npm run package +``` + ### How to structure your styles diff --git a/package.json b/package.json old mode 100755 new mode 100644 index d39264ce0..5488a141e --- a/package.json +++ b/package.json @@ -3,7 +3,16 @@ "title": "FoundationPress", "version": "1.4.0", "description": "FoundationPress is a WordPress starter theme based on Foundation 5 by Zurb", - "keywords": [ "FoundationPress", "WordPress", "starter theme", "Foundation", "semantic", "mobile first", "customizable", "responsive" ], + "keywords": [ + "FoundationPress", + "WordPress", + "starter theme", + "Foundation", + "semantic", + "mobile first", + "customizable", + "responsive" + ], "homepage": "http://foundationpress.olefredrik.com/", "bugs": "https://github.com/olefredrik/FoundationPress/issues", "license": "MIT", @@ -16,11 +25,12 @@ "bower": "^1.4.1", "grunt": "~0.4.1", "grunt-cli": "^0.1.13", + "grunt-contrib-compress": "^0.13.0", "grunt-contrib-concat": "~0.3.0", "grunt-contrib-copy": "~0.4.1", "grunt-contrib-uglify": "~0.2.7", "grunt-contrib-watch": "~0.5.3", - "grunt-sass": "1.0.0", + "grunt-sass": "^1.0.0", "grunt-string-replace": "~0.2.7", "node-sass": "3.2.0", "time-grunt": "^1.1.0" @@ -29,6 +39,7 @@ "build": "grunt build", "grunt": "grunt", "postinstall": "bower install && grunt build", - "watch": "grunt watch" + "watch": "grunt watch", + "package": "grunt package" } }