Skip to content
This repository has been archived by the owner on Sep 16, 2019. It is now read-only.

Feature/package theme for deployment #474

Merged
merged 5 commits into from
Sep 22, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ assets/components/
assets/javascript/vendor/
assets/javascript/foundation.js
assets/javascript/custom/demosite.js
packaged/
27 changes: 26 additions & 1 deletion Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down Expand Up @@ -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']);
};
};
10 changes: 9 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
17 changes: 14 additions & 3 deletions package.json
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"
Expand All @@ -29,6 +39,7 @@
"build": "grunt build",
"grunt": "grunt",
"postinstall": "bower install && grunt build",
"watch": "grunt watch"
"watch": "grunt watch",
"package": "grunt package"
}
}