jwvdiermen / grunt-include-source

Include lists of files into your source files automatically.
MIT License
68 stars 31 forks source link

use global config to parse template variables in basePath strings #11

Closed paulbdavis closed 10 years ago

paulbdavis commented 10 years ago

When overriding a basePath in a template, this allows for variagles from grunt.config.get to be used. Example

grunt.initConfig({
    buildDir: 'build/',
    includeSource: {
        options: {
            basePath: '<%= buildDir %>/js/app'
            baseUrl: 'js/app/'
        },
        all: {
            '<%= buildDir %>/index/html': ['<%= buildDir %>/index/html']
        }
    }
})
<!-- include: "type": "css", "basePath": "<%= buildDir %>/css", "baseUrl": "css/", "files": "**/*.css" -->
<!-- include: "type": "js", "basePath": "<%= buildDir %>/js/vendor", "baseUrl": "js/vendor/", "files": "**/*.js" -->
<!-- include: "type": "js", "files": "**/*.js" -->

In this case, all of the <%= buildDir %> tags become 'build/' before looking for files.