0.5.18 • Published 9 years ago

grunt-conkitty v0.5.18

Weekly downloads
1
License
MIT
Repository
github
Last release
9 years ago

grunt-conkitty Build Status

Compile Conkitty Templates

Install:

npm install grunt-conkitty --save-dev

Enable:

grunt.loadNpmTasks('grunt-conkitty');

Use (you can omit some of settings):

conkitty: {
    compile: {
        src: ['template1.ctpl', 'template2.ctpl'],
        dest: {
            common: 'path/to/generated/common.js',
            templates: 'path/to/generated/templates.js',
            sourcemap: 'path/to/sourcemap/for/templates.js',
            deps: 'dir/to/copy/dependencies/to'
        }
    }
}

deps is a directory to copy declared in templates dependencies to. For example, let's assume we have two template files. File /path/to/file1.ctpl depends from /path/to/script.js and file /another/path/file2.ctpl depends from /another/path/style.css. If our settings look like:

{
    templates: '/build/path/templates.js',
    deps: '/build/path/deps/'
}

The resulting structure in /build/path will be:

/build/path
    /deps
        1_script.js
        1_script.js_
        2_style.css
        2_style.css_
    templates.js

The dependencies are properly ordered, the files ending with underscore sign (1_script.js_ and 2_style.css_ in our example) contain an absolute path to the source.

You can also save your dependencies as a JSON-file:

{
    templates: '/build/path/templates.js',
    deps: {
        dest: '/build/path/deps/', // Path to copy the files to, the same to the example above.
        file: '/build/path/deps.json' // Path to JSON-file.
    }
}

In addition to previous example result, this one will create deps.json with the following contents:

[
    "/path/to/script.js",
    "/path/to/style.css"
]

Exclude concat.js from the common

By default concat.js is built in the common. You can exclude concat.js from the common:

conkitty: {
    compile: {
        src: ['template1.ctpl', 'template2.ctpl'],
        dest: {
            common: {file: 'path/to/generated/common.js', 'concat.js': false},
            templates: 'path/to/generated/templates.js',
            sourcemap: 'path/to/sourcemap/for/templates.js',
            deps: 'dir/to/copy/dependencies/to'
        }
    }
}

Passing an environment object for precompile expressions

You can pass an environment object for precompile expressions:

conkitty: {
    compile: {
        src: ['template1.ctpl', 'template2.ctpl'],
        dest: {
            env: {prop1: 111, prop2: 'dark', prop3: true},
            common: 'path/to/generated/common.js',
            templates: 'path/to/generated/templates.js'
        }
    }
}
0.5.18

9 years ago

0.5.17

9 years ago

0.5.16

10 years ago

0.5.15

10 years ago

0.5.14

10 years ago

0.5.13

10 years ago

0.5.12

10 years ago

0.5.11

10 years ago

0.5.10

10 years ago

0.5.8

10 years ago

0.5.6

10 years ago

0.5.5

10 years ago

0.5.4

10 years ago

0.5.3

10 years ago

0.5.2

10 years ago

0.5.1

10 years ago

0.5.0

10 years ago

0.4.9

10 years ago

0.4.8

10 years ago

0.4.7

10 years ago

0.4.6

10 years ago

0.4.5

10 years ago

0.4.4

10 years ago

0.4.3

10 years ago

0.4.2

10 years ago

0.2.1

10 years ago

0.2.0

10 years ago

0.1.3

10 years ago

0.1.2

10 years ago

0.1.1

10 years ago

0.1.0

10 years ago