Giter Site home page Giter Site logo

wpbs-grunt's Introduction

WordPress theme setup and configuration with _s(underscores), Bootstrap 3.0 (Bootstrap SASS https://github.com/twbs/bootstrap-sass), Grunt and wp_bootstrap_navwalker (wp-bootstrap-navwalker https://github.com/twittem/wp-bootstrap-navwalker)

Requirements / Assumptions

This task requires you to have Ruby, Sass, and Compass >=1.0.1 installed. If you're on OS X or Linux you probably already have Ruby installed; test with ruby -v in your terminal. When you've confirmed you have Ruby installed, run gem update --system && gem install compass to install Compass and Sass.

The Purpose of WPBS - Grunt

This file automates the process of adding Bootstrap to a Wordpress theme. It creates a new Wordpress theme based off _s (Underscore), downloads a copy of Bootstrap Sass and Wp Nav Walker. It adds Bootstrap to the new theme along with a basic Grunt file so you can get your project going quickly.

Getting Started

Step 1.

Create a temporary directory to build the theme in.

$ mkdir dir mynewtheme

$cd mynewtheme

$ git clone https://github.com/tedgeving/wpbs-grunt.git

$cd wpbs-grunt

$ npm install

$ grunt

Answer some questions. The theme is built in a new directory named after the value entered in the first question. The default directory is _s. The theme name needs to be one word all lower case. The input does not have validation or slugify the theme name.

If everything worked correctly you should see the following output in the terminal:

Created 9 directories, copied 106 files

Step 2.

Copy the new theme to your development environment.

In the theme directory run the following commands from the terminal:

$ npm install

$ grunt

Open a your text editor and save the file "aasets/styles.scss". This will generate a new style sheet in the root of the theme, "styles.css" which now includes bootstrap and any customs styles added to it. Login to the Worpdress install and activate the theme. It should look like the default bootstrap files are applied.

Also I highly recommend overriding all bootstrap variables in "assets/_bootstrap_variables.scss" instead of the core files. It makes it easier to update the framework and keep track of customizations.

It is possible to customize Bootstrap by including only the components that are needed. Comment out modules in "assets/sylessheets/_bootstrap.scsss" that are not needed.

Step 3.

Extra Configuration

Add the following snippet to functions.php

Enque Bootstraps JS

wp_enqueue_script( '{mythemename}', get_template_directory_uri() . '/assets/javascripts/bootstrap.min.js', array('jquery'), '20120208', true );

Enable live reload

if (in_array($_SERVER['SERVER_ADDR'], ['127.0.0.1', '192.168.50.4']) || pathinfo($_SERVER['SERVER_NAME'], PATHINFO_EXTENSION) == 'dev') {
    wp_enqueue_script( 'livereload', '//localhost:35729/livereload.js', '', false, true );

}`

Documentation for the nav walker class, useful for building default bootstrap navigation bar from a WP Menu. https://github.com/twittem/wp-bootstrap-navwalker

wpbs-grunt's People

Contributors

tedgeving avatar

Watchers

Jentan Bernardus avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.