Code for quickly setting up a simple site. We have taken Sage and stripped it of everything related to WordPress. What we are left with is the excellent handling of assets.
We have also added some optional routing and templating functionality in an, for lack of a better name, "advanced" version.
##Advanced version The advanced version comes with the following features:
- Routing courtsey of Altorouter
- Templating using philo/laravel-blade
- All the above is installed using Composer
- Download the latest version of Feverfew
- Run
composer install
- Delete index.basic.php
- Install Sage as described below.
- Set up some routes in index.php and start coding!
Place your views in blade-views. Read how to create routes at altorouter.com and how to work with the templates in the Readme of PhiloNL/Laravel-Blade.
##Basic version If you are only creating one simple page, this is probably a better option than the advanced one.
- Download the latest version of Feverfew
- Delete blade-cache/, blade-views/, composer.json, composer.lock, index.php, and .htaccess
- Rename index.basic.php to index.php
- Install Sage as described below.
- Start coding!
Start each page by requiring functions.php. Once you have done that, you can include an asset like so: <link rel="stylesheet" href="<?php echo Roots\Sage\Assets\asset_path('styles/main.css'); ?>">
where the file name is one specified on assets/manifest.json.
I, Björn Folbert, work at the largest communication agency in southern Sweden. We call ourselves FEW (oh, the irony). From time to time we have positions open for web developers and programmers in the Malmö/Copenhagen area, so please get in touch using [email protected] if you want to know more!
Below is the content of the Readme of the verison of Sage currently used by Feverfew.
Sage is a WordPress starter theme based on HTML5 Boilerplate, gulp, Bower, and Bootstrap Sass, that will help you make better themes.
- Source: https://github.com/roots/sage
- Homepage: https://roots.io/sage/
- Documentation: https://roots.io/sage/docs/
- Twitter: @rootswp, @retlehs, @swalkinshaw, @Foxaii, @c2foryou, @austinpray
- Newsletter: Subscribe
- Forum: https://discourse.roots.io/
Prerequisite | How to check | How to install |
---|---|---|
PHP >= 5.4.x | php -v |
php.net |
Node.js 0.12.x | node -v |
nodejs.org |
gulp >= 3.8.10 | gulp -v |
npm install -g gulp |
Bower >= 1.3.12 | bower -v |
npm install -g bower |
For more installation notes, refer to the Install gulp and Bower section in this document.
- gulp build script that compiles both Sass and Less, checks for JavaScript errors, optimizes images, and concatenates and minifies files
- BrowserSync for keeping multiple browsers and devices synchronized while testing, along with injecting updated CSS and JS into your browser while you're developing
- Bower for front-end package management
- asset-builder for the JSON file based asset pipeline
- Sass Bootstrap
- Theme wrapper
- ARIA roles and microformats
- Posts use the hNews microformat
- Multilingual ready and over 30 available community translations
Install the Soil plugin to enable additional features:
- Cleaner output of
wp_head
and enqueued assets - Cleaner HTML output of navigation menus
- Root relative URLs
- Nice search (
/search/query/
) - Google CDN jQuery snippet from HTML5 Boilerplate
- Google Analytics snippet from HTML5 Boilerplate
Clone the git repo - git clone https://github.com/roots/sage.git
and then rename the directory to the name of your theme or website.
If you don't use Bedrock, you'll need to add the following to your wp-config.php
on your development installation:
define('WP_ENV', 'development');
Edit lib/config.php
to enable or disable theme features
Edit lib/init.php
to setup navigation menus, post thumbnail sizes, post formats, and sidebars.
Sage uses gulp as its build system and Bower to manage front-end packages.
Building the theme requires node.js. We recommend you update to the latest version of npm: npm install -g npm@latest
.
From the command line:
- Install gulp and Bower globally with
npm install -g gulp bower
- Navigate to the theme directory, then run
npm install
- Run
bower install
You now have all the necessary dependencies to run the build process.
gulp
— Compile and optimize the files in your assets directorygulp watch
— Compile assets when file changes are madegulp --production
— Compile assets for production (no source maps).
To use BrowserSync during gulp watch
you need to update devUrl
at the bottom of assets/manifest.json
to reflect your local development hostname.
For example, if your local development URL is http://project-name.dev
you would update the file to read:
...
"config": {
"devUrl": "http://project-name.dev"
}
...
If your local development URL looks like http://localhost:8888/project-name/
you would update the file to read:
...
"config": {
"devUrl": "http://localhost:8888/project-name/"
}
...
Sage documentation is available at https://roots.io/sage/docs/.
Contributions are welcome from everyone. We have contributing guidelines to help you get started.
Keep track of development and community news.
- Participate on the Roots Discourse
- Follow @rootswp on Twitter
- Read and subscribe to the Roots Blog
- Subscribe to the Roots Newsletter