From bcbdbbd9bee016eb2ea3eab8c126209a15d853f5 Mon Sep 17 00:00:00 2001 From: Preston M Date: Mon, 21 Sep 2015 18:10:33 -0500 Subject: [PATCH 1/3] Merged all to latest commits on main branch adding package command Adding package command. --- Gruntfile.js | 16 +++++++++++++++- package.json | 14 ++++++++++++-- 2 files changed, 27 insertions(+), 3 deletions(-) mode change 100755 => 100644 package.json diff --git a/Gruntfile.js b/Gruntfile.js index f164ea897..1da37dee0 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -5,6 +5,18 @@ module.exports = function (grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), + //package the theme as zipe file so it can be uploaded as a theme and remove folders + compress: { + main: { + options: { + archive: 'packaged/<%= pkg.name %>.zip' + }, + expand: true, + cwd: '.', + src: ['**/*','!**/node_modules/**','!**/bower_components/**','!**/scss/**','!**/deploy/**','!**/bower.json','!**/Gruntfile.js','!**/package.json','!**/composer.json','!**/composer.lock','!**/codesniffer.rulese.xml'], + dest: '<%= pkg.name %>' + }, + }, sass: { options: { @@ -153,7 +165,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/package.json b/package.json old mode 100755 new mode 100644 index d39264ce0..67c2cf564 --- 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" From 5ba64fa914d96c6bf4f92c8d6ee2241b9cb09043 Mon Sep 17 00:00:00 2001 From: olefredrik Date: Tue, 22 Sep 2015 09:12:30 +0200 Subject: [PATCH 2/3] Add package as npm script. Modify the package command --- .gitignore | 1 + Gruntfile.js | 21 ++++++++++++++++----- package.json | 3 ++- 3 files changed, 19 insertions(+), 6 deletions(-) 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 1da37dee0..96561a4d8 100755 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -5,7 +5,7 @@ module.exports = function (grunt) { grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), - //package the theme as zipe file so it can be uploaded as a theme and remove folders + // Compress and zip only the files required for deployment to the server. Exclude all dev dependencies. compress: { main: { options: { @@ -13,7 +13,18 @@ module.exports = function (grunt) { }, expand: true, cwd: '.', - src: ['**/*','!**/node_modules/**','!**/bower_components/**','!**/scss/**','!**/deploy/**','!**/bower.json','!**/Gruntfile.js','!**/package.json','!**/composer.json','!**/composer.lock','!**/codesniffer.rulese.xml'], + src: [ + '**/*', + '!**/node_modules/**', + '!**/components/**', + '!**/scss/**', + '!**/bower.json', + '!**/Gruntfile.js', + '!**/package.json', + '!**/composer.json', + '!**/composer.lock', + '!**/codesniffer.ruleset.xml' + ], dest: '<%= pkg.name %>' }, }, @@ -165,9 +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.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/package.json b/package.json index 67c2cf564..5488a141e 100644 --- a/package.json +++ b/package.json @@ -39,6 +39,7 @@ "build": "grunt build", "grunt": "grunt", "postinstall": "bower install && grunt build", - "watch": "grunt watch" + "watch": "grunt watch", + "package": "grunt package" } } From 83cec1c54b9ee4238b65e129946fac92d0cd1914 Mon Sep 17 00:00:00 2001 From: olefredrik Date: Tue, 22 Sep 2015 09:21:13 +0200 Subject: [PATCH 3/3] Update the README with package instructions --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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