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

Commit

Permalink
removed global dependency of bower and grunt - #274
Browse files Browse the repository at this point in the history
fix coding style & update readme
  • Loading branch information
stefanjudis committed May 12, 2015
1 parent b7dc458 commit 85e631d
Show file tree
Hide file tree
Showing 2 changed files with 67 additions and 24 deletions.
73 changes: 54 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,51 +2,86 @@

This is a WordPress starter theme based on Foundation 5 by Zurb. The purpose of FoundationPress, is to act as a small and handy toolbox that contains the essentials needed to build any design. FoundationPress is meant to be a starting point, not the final product. If you're looking for an all-in-one theme with built-in shortcodes, plugins, fancypancy portfolio templates or whatnot, I'm afraid you have to look elsewhere.

Please fork, copy, modify, delete, share or do whatever you like with this.
Please fork, copy, modify, delete, share or do whatever you like with this.

All contributions are welcome!

## Requirements

**A brief explanation to the requirements** (feel free to skip this if you're a pro):

Back in the days we wrote all styles in the style.css file. Then we realized that this could quickly create clutter and confusion, especially in larger projects. Foundation uses SASS (equivalent to LESS, used in Bootstrap). In short, SASS is a CSS pre-processor that allows you to write styles more effectively and tidy.
Back in the days we wrote all styles in the style.css file. Then we realized that this could quickly create clutter and confusion, especially in larger projects. Foundation uses SASS (equivalent to LESS, used in Bootstrap). In short, SASS is a CSS pre-processor that allows you to write styles more effectively and tidy.

To compile SASS files into one style sheet, we use a tool called Grunt. In short, Grunt is a task runner that automates repetitive tasks like minification, compilation, linting, etc. Grunt and Grunt plugins are installed and managed via npm, the Node.js package manager. Before setting up Grunt ensure that your npm is up-to-date by running ```npm update -g npm``` (this might require ```sudo``` on certain systems)

Bower is a package manager used by Zurb to distribute Foundation. When you have Bower installed, you will be able to run ```foundation update``` in the terminal to update Foundation to the latest version. (After an upgrade you must run ```grunt build``` to recompile files).
Bower is a package manager used by Zurb to distribute Foundation. When you have Bower installed, you will be able to run ```foundation update``` in the terminal to update Foundation to the latest version. (After an upgrade you must run ```npm run build``` to recompile files).


**Okay, so you'll need to have the following items installed before continuing.**
**Okay, so you'll need to have [Node.js](http://nodejs.org) installed before continuing.**

* [Node.js](http://nodejs.org)
* [Grunt](http://gruntjs.com/): Run `[sudo] npm install -g grunt-cli`
* [Bower](http://bower.io): Run `[sudo] npm install -g bower`
**And that is it.**

Many project force their users to install [Bower](http://bower.io) and [Grunt](http://gruntjs.com/) globally. We don't like that and decided to use them via `npm scripts` which means, that Grunt and Bower are installed in your `node_modules` folder and we'll call them there.

Haven't used this approach yet? Read on.

## Quickstart

```bash
cd my-wordpress-folder/wp-content/themes/
git clone git@github.com:olefredrik/FoundationPress.git
mv FoundationPress your-theme-name
cd your-theme-name
npm install && bower install && grunt build
$ cd my-wordpress-folder/wp-content/themes/
$ git clone git@github.com:olefredrik/FoundationPress.git
$ mv FoundationPress your-theme-name
$ cd your-theme-name

# will call:
# bower install && grunt build
# afterwards
# check `package.json` `scripts`
# for further information
$ npm install
```

**Tip:**
**Tip:**
If you get an error saying Permission denied (publickey) when cloning the repository, use the https protocol instead:
```git clone https://github.com/olefredrik/FoundationPress.git```

While you're working on your project, run:

`grunt watch`
```bash
# will call:
# grunt watch
#
# predefined in `package.json`
$ npm run watch
```

For building all the assets, run:

```bash
# will call:
# grunt build
#
# predefined in `package.json`
$ npm run build
```

And you're set!

Check for Foundation Updates? Run:
`foundation update`
`$ foundation update`
(this requires the foundation gem to be installed in order to work. Please see the [docs](http://foundation.zurb.com/docs/sass.html) for details.)

Wanna run a custom grunt task? Run:
```bash
# will call:
# grunt sass
$ npm run grunt -- sass

# will call:
# grunt copy
$ npm run grunt -- copy
```

### Stylesheet Folder Structure

* `style.css`: Do not worry about this file. (For some reason) it's required by WordPress. All styling are handled in the Sass files described below
Expand All @@ -55,19 +90,19 @@ Check for Foundation Updates? Run:
* `scss/config/_settings.scss`: Original Foundation 5 base settings
* `scss/config/_custom-settings.scss`: Copy the settings you will modify to this file. Make it your own
* `scss/site/*.scss`: Unleash your creativity and make it look perfect. Create the files you need (and remember to make import statements for all your files in scss/foundation.scss)

* `css/foundation.css`: All Sass files are minified and compiled to this file
* `css/foundation.css.map`: CSS source maps

### Script Folder Strucutre

* `bower_components/`: This is the source folder where all Foundation components are located. `foundation update` will check and update scripts in this folder.

* `js/custom`: This is where you put all your custom scripts. Every .js file you put in this directory will be minified and concatinated to [foundation.js](https://github.com/olefredrik/FoundationPress/blob/master/js/foundation.js)

* `js/vendor`: Vendor scripts are copied from `bower_components/` to this directory. We use this path for enqueing the vendor scripts in WordPress.

* Please note that you must run `grunt build` in your terminal for the script to be copied and concatinated. See [Gruntfile.js](https://github.com/olefredrik/FoundationPress/blob/master/Gruntfile.js) for details
* Please note that you must run `npm run build` in your terminal for the script to be copied and concatinated. See [Gruntfile.js](https://github.com/olefredrik/FoundationPress/blob/master/Gruntfile.js) for details

## Demo

Expand Down Expand Up @@ -142,4 +177,4 @@ Pull requests are highly appreciated. More than three dozen amazing people have
## Documentation

* [Zurb Foundation Docs](http://foundation.zurb.com/docs/)
* [WordPress Codex](http://codex.wordpress.org/)
* [WordPress Codex](http://codex.wordpress.org/)
18 changes: 13 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,28 @@
"name": "foundationpress",
"version": "5.5.2",
"devDependencies": {
"node-sass" : "~2.0.1",
"bower": "^1.4.1",
"grunt": "~0.4.1",
"grunt-contrib-watch": "~0.5.3",
"grunt-sass": "~0.18.0",
"grunt-contrib-copy": "~0.4.1",
"grunt-cli": "^0.1.13",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-copy": "~0.4.1",
"grunt-contrib-uglify": "~0.2.7",
"grunt-string-replace": "~0.2.7"
"grunt-contrib-watch": "~0.5.3",
"grunt-sass": "~0.18.0",
"grunt-string-replace": "~0.2.7",
"node-sass": "~2.0.1"
},
"repository": {
"type": "git",
"url": "https://github.com/olefredrik/FoundationPress.git"
},
"dependencies": {
"time-grunt": "^1.1.0"
},
"scripts": {
"build": "grunt build",
"grunt": "grunt",
"postinstall": "bower install && grunt build",
"watch": "grunt watch"
}
}

0 comments on commit 85e631d

Please sign in to comment.