Giter Site home page Giter Site logo

html5-blank-slate's Introduction

h5bs Theme

Basic Setup

Install nodejs and yarn:

From the console, change directories into the WordPress Theme

cd {path}/wp-content/themes/{theme_name}

Install gulp (one time)

npm install -g gulp

Run yarn to get install the JS dependencies

yarn

Run gulp dist once initially, then when it's time to deploy or when you add files to the commons or vendor bundles (see advanced usage below). This will clean the assets dirs and compile all the JS/CSS bundles. For deploy, you then just copy the assets dir up to the server.

gulp dist

Run gulp watch to watch for changes to the apps main scss/js source files as you work. This will compile any changes made to files js/css in src/ to their bundles in assets/. Note this only watches files in src/; if, for example, you install an npm module and add it to the vendor bundle (see advanced usage) you will need to rerun gulp dist (or gulp js-vendor) to regenerate the vendor bundle.

gulp watch

Browsersync

As an alternative to gulp watch, there is a task to run a browsersync server locally, gulp server. By default it binds to localhost. This and other options are found in gulpconfig.yml.

Advanced JS Pipeline Usage

The JS pipeline allows for writing code using CommonJS/node or ES6 syntax, and because of browserify, allows you to use appropriate modules from the npm ecosystem in the JS bundle without any configuration outside of yarn add {the module} and require'ing (CommonJS) or import'ing (ES6) the module in your code.

This means for example you could, at the command line:

yarn add underscore

Then in a bundled JS file:

import _ from 'underscore';

OR equivalently:

var underscore = require('underscore');

If the modules you include grow in number or are complex, you might find that your JS build time slows down. Optionally, you can add modules to the commons bundle such that they're compiled separately. Continuing the exmaple above, you'd edit gulpconfig.yml to make this happen, adding "underscore" to the commons modules array.

If you need to add other vendor JS scripts which are not common required modules, you'd edit gulpconfig.yml to add their full paths to the vendor paths array. By default this is how foundation.js is included. Other examples would be any self contained script that expects to be loaded via a <script> tag, e.g. jQuery plugins or polyfills/shims.

Advanced CSS Pipeline Usage

The CSS pipeline is less complex than the JS, but there are still some options to be configured in gulpconfig.yml. The full options objects passed to autoprefixer and sass are found here. A common change might be the browsers targeted by the autoprefixer. By default it is latest 2 versions. See other examples here.

html5-blank-slate's People

Contributors

ferne97 avatar numbers1311407 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.