How to use the grunt-jquery-content.postPreprocessors function in grunt-jquery-content

To help you get started, we’ve selected a few grunt-jquery-content examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jquery / meetings.jquery.org / Gruntfile.js View on Github external
},
	wordpress: (function() {
		var config = require( "./config" );
		config.dir = "dist/wordpress";
		return config;
	})()
});

grunt.registerTask( "build-categories", function() {
	grunt.file.write(
		grunt.config( "wordpress.dir" ) + "/taxonomies.json",
		JSON.stringify( taxonomies )
	);
});

jqueryContent.postPreprocessors.post = (function() {
	var teamNames = {};

	taxonomies.category.forEach(function( category ) {
		teamNames[ category.slug ] = category.name;
	});

	return function( post, postPath, callback ) {
		var categorySlug = postPath.replace( /^.+?.+\/(.+)\/(.+)\.\w+$/, "$1" ),
			postDateSlug = postPath.replace( /^.+?.+\/(.+)\/(.+)\.\w+$/, "$2" ),
			postDate = new Date( postDateSlug + " 12:00:00"),

			// Slice off the "DAY " from the date string
			postDateString = postDate.toDateString().slice( 4 ),
			teamName = teamNames[ categorySlug ];

		post.title = teamName + " Meeting - " + postDateString;
github jquery / learn.jquery.com / Gruntfile.js View on Github external
if ( typeof item === "object" ) {
				var page = Object.keys( item )[ 0 ];
				map[ prefix + page ] = ++index;
				walk( item[ page ], prefix + page + "/" );
			} else {
				map[ prefix + item ] = ++index;
			}
		});
	}

	walk( require( "./order" ), "" );

	return map;
}

jqueryContent.postPreprocessors.page = (function() {
	var orderMap = getOrderMap();

	return function( post, postPath, callback ) {
		var slug = postPath.replace( /^.+?\/(.+)\.\w+$/, "$1" ),
			menuOrder = orderMap[ slug ];

		if ( menuOrder ) {
			post.menuOrder = menuOrder;
		}

		callback( null, post );
	};
})();

grunt.registerTask( "build", [ "build-posts", "build-resources" ] );

grunt-jquery-content

A collection of tasks for building the jQuery websites

Unrecognized
Latest version published 1 year ago

Package Health Score

63 / 100
Full package analysis

Popular grunt-jquery-content functions