Git Product home page Git Product logo

wds-grunt-wp-plugin's Introduction

grunt-wp-plugin

Create a WordPress plugin with grunt-init.

Installation

If you haven't already done so, install grunt-init.

Once grunt-init is installed, place this template in your ~/.grunt-init/ directory. It's recommended that you use git to clone this template into that directory, as follows:

Linux/Mac Users

git clone https://github.com/WebDevStudios/grunt-wp-plugin.git ~/.grunt-init/wp-plugin

Windows Users

git clone https://github.com/WebDevStudios/grunt-wp-plugin.git %USERPROFILE%/.grunt-init/wp-plugin

Usage

At the command-line, cd into an empty directory, run this command and follow the prompts.

grunt-init wp-plugin

Note that this template will generate files in the current directory, so be sure to change to a new directory first if you don't want to overwrite existing files.

Install the NPM modules required to actually process your newly-created project by running:

npm install

Scaffold

After running the init command above, you will be presented with a standard directory structure similar to:

/plugin
.. /assets
.. .. /css
.. .. .. /src
.. .. .. /sass
.. .. .. /less
.. .. /js
.. .. .. /src
.. .. /images
.. .. .. /src
.. /includes
.. /languages
.. .. plugin.pot
.. .gitignore
.. Gruntfile.js
.. plugin.php
.. README.md
.. readme.txt

CSS vs Sass vs LESS

Depending on how you answer the prompt regarding the use of a preprocessor, you will either have a /src directory (CSS), a /sass directory (Sass), or a /less directory (LESS) under your normal /css directory. The goal here is that you only ever edit files in the related source directory and Grunt will automatically build and minify your final stylesheets directly in /css.

If you're using Sass or Less, the raw files will be processed into /css/filename.css and minified into /css/filename.min.css.

If you're using vanilla CSS, the source files will be minified into /css/filename.min.css.

JavaScript

You should only ever be modifying script files in the /js/src directory. Grunt will automatically concatenate and minify your scripts into /js/filename.js and /js/filename.min.js. These generated files should never be modified directly.

Images

The assets/images/src directory exists only to allow you to keep track of source files (like PSDs or separate images that have been merged into sprites). This helps keep source files under version control, and allows you to bundle them with the distribution of your new GPL plugin.

Release History

  • 2015-02-04 v0.1.8 Use hyphens for filenames, better .gitignore, better JS banner templates, optional WP code sniffer grunt task, optional autoloader.
  • 2013-07-18 v0.1.5 Remove /extend references (props @trepmal).
  • 2013-05-30 v0.1.4 Fix broken package.json generator.
  • 2013-05-06 v0.1.3 Several I18N updates (props @bradyvercher)
  • 2013-04-29 v0.1.2 Folder restructuring and renaming.
  • 2013-04-26 v0.1.1 Minor bug fixes.
  • 2013-04-25 v0.1.0 Initial public release.

wds-grunt-wp-plugin's People

Contributors

bradyvercher avatar ericmann avatar jaywood avatar johnpbloch avatar jtsternberg avatar tddewey avatar trepmal 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.