forked from ractivejs/v0.x
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Gruntfile.js
74 lines (58 loc) · 2.08 KB
/
Gruntfile.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/* The one-size-fits-all key to Grunt.js happiness - http://bit.ly/grunt-happy */
/*global module:false*/
module.exports = function ( grunt ) {
'use strict';
var config, dependency;
require( 'jit-grunt' )( grunt );
config = {
pkg: grunt.file.readJSON( 'package.json' ),
latest: '0.7',
edge: 'edge',
prod: grunt.option( 'prod' ),
// TODO do we need this?... probably not, it just got
// copied and pasted in
paths: {
'shared': '../../shared',
// libraries
'ractive': 'lib/ractive',
// loaders
'amd-loader': 'loaders/amd-loader',
'rvc': 'loaders/rvc'
},
nav: function ( selected ) {
var partial = grunt.file.read( 'shared/partials/nav.html' );
return grunt.template.process( partial, {
data: { id: selected }
});
},
analytics: function ( gaTrackingId, gaProperty ) {
var partial = grunt.file.read( 'shared/partials/analytics.html' );
return grunt.template.process( partial, {
data: { gaTrackingId: gaTrackingId, gaProperty: gaProperty }
});
},
head: grunt.file.read( 'shared/partials/head.html' ),
footer: grunt.file.read( 'shared/partials/footer.html' ),
getEditLink: function ( file ) {
var source = grunt.editLinkReverseMapping[ file ];
return 'https://github.com/ractivejs/docs.ractivejs.org/edit/master/docs/' + source;
}
};
grunt.editLinkReverseMapping = {};
// Read config files from the `grunt/config/` folder
grunt.file.expand( 'grunt/config/*.js' ).forEach( function ( path ) {
var property = /grunt\/config\/(.+)\.js/.exec( path )[1],
module = require( './' + path );
config[ property ] = typeof module === 'function' ? module( grunt ) : module;
});
// Initialise grunt
grunt.initConfig( config );
// Load development dependencies specified in package.json
for ( dependency in config.pkg.devDependencies ) {
if ( /^grunt-/.test( dependency) ) {
grunt.loadNpmTasks( dependency );
}
}
// Load tasks from the `grunt-tasks/` folder
grunt.loadTasks( 'grunt/tasks' );
};