Repository navigation
Grunt Tasks
Grunt is a JavaScript task runner used to perform menial, repetitive manual tasks such as minification, linting, etc..
Responsive Framework has several Grunt tasks. Each is detailed below. Some
tasks have sub-tasks, which can be run by calling the parent task followed by a
: followed by the sub-task name. Example: sass:dev.
Grunt tasks run functions defined in your dependencies and Gruntfile.js file.
Below are the Grunt tasks and how they are configured in Responsive Framework.
Each can be run by typing grunt taskname when in terminal viewing the
framework's directory.
Combines all JavaScript folders in the following directories into a single
file, /js/script.js.
Takes any file in the following directories ending with .js (but not
.min.js) and creates a minified version with the same name, adding .min.
/js/js/vendor
Compiles framework SASS into CSS files. The following directories are included before the SASS is compiled:
bower_components/normalize.scss/sassbower_components/mathsass/dist/bower_components/responsive-foundation/css-dev
This function has several parts.
Compiles the following SASS files into CSS files.
-
css-dev/style.scssintostyle.css -
css-dev/ie.scssintoie.css
Compiles the following SASS files into CSS files.
-
css-dev/style.scssintostyle.min.css -
css-dev/ie.scssintoie.min.css
Compiles all .scss files in the css-dev/customizer/font-palettes directory
(not recursively) into the css directory.
Example: css-dev/customizer/font-palettes/f1.scss becomes css/f1.css.
The file css-dev/admin.scss is compiled into admin/admin.css.
Adds a textdomain argument to all gettext functions missing one and
replaces all textdomain arguments that are not responsive-framework.
Generates a responsive-framework.pot file and stores it in the /languages
directory. This file can be used by a translator to localize the framework into
another language.
Uses regular expressions to replace hardcoded version numbers in code.
This task has several sub-tasks.
Updates the RESPONSIVE_FRAMEWORK_VERSION constant's value to match the
version property in the package.json file.
Updates the theme version in css-dev/style.scss file to match the
package.json file.
Updates the RESPONSIVE_MODERNIZR_VERSION constant's value to match the
version in the modernizr dependency's package.json file.
Updates the RESPONSIVE_LIGHTGALLERY_VERSION constant's value to match the
version in the lightgallery dependency's package.json file.
Updates the RESPONSIVE_LG_THUMBNAIL_VERSION constant's value to match the
version in the lightgallery dependency's package.json file.
Copies files from one directory to another. This task has sub-tasks.
Copies hooks/post-merge/ to .git/hooks/post-merge.
Copies the contents of node_modules/lightgallery/dist to
js/vendor/lightgallery.
Copies the contents of node_modules/lg-thumbnail/dist to
js/vendor/lg-thumbnail.
Searches all PHP files (excluding the vendor and node_modules directories)
and checks for any fatal errors, which are an indication of syntax errors.
Installs all Bower dependencies to the bower_components directory.
Creates a custom build of Modernizr with the tests and options specified in the
task's settings. The generated file is saved as js/vendor/modernizr.js.
Removes all files in the /languages folder (see #376).
Tells Grunt to watch for changes and run Grunt tasks when changes occur. The following files are monitored for changes and run the specified Grunt tasks:
-
Gruntfile.js(reloads Grunt, applying any task changes made) - JavaScript files (changes trigger
concat,uglify)- Any
.jsfile inbower_components/responsive-foundation/js-dev - Any
.jsfile in/js-dev - Any
.jsfile in/js/vendor
- Any
- SASS files (changes trigger
sass:devandsass:prod)- Any
.scssfile inbower_components/responsive-foundation/css-dev - Any
.scssfiles in/css-dev
- Any
- Any
.scssfiles in/css-dev/customizer/font-palettes(triggerssass:fonts) -
css-dev/admin.scss(triggerssass:admin) - Any PHP file (triggers
phplint)
A Grunt task can also run a combination of tasks in a specific order. Here are the Grunt combination tasks available.
This is the default Grunt command. When this command is run, Bower dependencies
are installed and the watch function is invoked, causing the terminal window
to wait for specified files to change (see watch detailed above).
copy:hooksbower:install-
build(see below)
cleanaddtextdomainmakepot
sass
phplintconcatuglify
See ## LINK ## Upgrading jQuery lightGallery in the Framework for more information.
copy:lightgallerycopy:lgthumbnailversion:lightgalleryversion:lg_thumbnail
See ## LINK ## Upgrading Modernizr in the Framework for more information.
modernizr:distuglifyversion:modernizr
This is the master Grunt task.
bower:installsassscriptsi18n
Get started
Configuration
Build child themes
- Customizing CSS in a child theme
- Overriding templates in a child theme
- Code patterns
- Code reviews
- Pulling in Foundation Updates
- Merging and Creating a Pull Request
Sass
Javascript
PHP
- Coding Standards
- PHP Constants
- Temp PHP Code Patterns
- PHP Snippets
- How to Use Hooks
- Action Hooks
- Using Action Hooks To Output Markup
- Filter Hooks
Shortcodes
Templates
GitHub
Tasks
Contribute to the framework
- Framework Development and Release Workflows
- Documentation Template
- Testing your changes
- Creating a new release
- Migration Guide
- Needs Documentation
Code Examples
- Adding Content Container Classes
- Adding News Templates
- Adding Script Dependencies
- Changing Available Layouts and Default Layout
- Displaying a Fancy Gallery
- Loading a Custom Build of Modernizr
- Loading Modernizr in the Footer
- Using Action Hooks To Output Markup
- Understanding get_template_part
BU Developer Resources