A collection of tasks for building the jQuery web sites via Grunt.
This task removes all files in the
This is an empty task list. If the site contains any lint checks, they should be defined here. For example, API sites should have the following task list:
grunt.registerTask( "lint", [ "xmllint" ] );
This is a task list that must be defined per site, containing all of the build steps. A simple site would have the following task list:
grunt.registerTask( "build", [ "build-posts", "build-resources" ] );
This multi-task takes a list of html or markdown files, copies them to
@partial entries and highlights the syntax in each. The keys are the post types for each set of posts.
postPreprocessors export for a hook to implement custom processing.
Using markdown files provides additional features over HTML files. By default, links for each header are automatically generated for markdown files.
In addition to the standard metadata for post files, the following properties can be set:
noHeadingLinks: When set to
false, heading links won't be generated.
toc: When set to
true, a table of contents will be inserted at the top of the post based on the headings within the post.
resources/code-sample.html is a relative path in the current directory. That html file will be inserted, escaped and highlighted.
Inside markup included with
@partial, you can mark sections of code as
@placeholder code, to be excluded from the inserted code, replaced with an html comment.
regular markup will show up here <!-- @placeholder-start(more markup) --> this will be replaced <!-- @placeholder-end --> other content
That will result in:
regular markup will show up here <!-- more markup --> other content
This mult-task copies all source files into
This multi-task lints XML files to ensure the files are valid.
This multi-task generates HTML files to be published to WordPress by parsing the source XML files and transforming them through
entries2html.xsl. The generate files are copied to
The content repo must create its own
entries2html.xsl file which must import
This task reads
categories.xml from the root of the content repo and generates
categories.xml should have the following format:
<categories> <category name="Category 1" slug="category1"> <desc>A description of the category.</desc> <category name="Subcategory" slug="subcategory"> <desc><![CDATA[A description containing <em>HTML</em>!]]></desc> </category> <category name="Another Category" slug="another-category"> <desc>This category is boring.</desc> </category> </categories>
Code examples in the descriptions will be syntax highlighted.
This task generates a single XML file that contains all entries and stores the result in
This module also exports some methods through the standard node
syntaxHighlight( content )
Syntax highlights content.
contentString: The string the highlight.
Hooks for modifying the posts before they're processed in the
postPreprocessors is a hash of preprocessors, where the key is the post type and the value is a function which modifies the post.
The functions must be in the form of:
function( post, fileName, callback )
postObject: The post being processed.
fileNameString: The name of the file used to generate the post object.
callbackfunction( error, post ): Callback to invoke after modifying the post.
Errorinstance, if there was an error while modifying the post.
postThe modified post.
By default, posts are placed in the
[wordpress.dir]/[post-type] directory using the same relative path and file name as the source file. The relative path can be changed by setting the
fileName property on the post.
If a preprocessor is not defined for the given post type, then the
_default preprocessor will be used.