Пример #1
0
    tools.forEachInDirset(elements.get('dirset').get(0), function (localeDir, baseDir) {
        var todir = baseDir + '/' + localeDir,
            fileset = tools.createFileset(todir, "**/*.html");

        tools.forEachInFileset(fileset, function (partial, partialFile) {
            var filename = normalizePath(partialFile),
                id = prefix + filename;

            templates.push("'" + id + "'");
            tools.writeStringToFile(templatePartial({id: id, content: escapeContent(partial)}), todir, filename + '.js');
        });

        tools.writeStringToFile(templateModule({templates: templates.join(', ')}), todir, 'templates.js');
    });
Пример #2
0
(function (project, attributes, elements, require) {
    var root = project.getProperty('basedir') + '/',
        tools = require(root + 'lib/build/tools.js');

    tools.forEachInFileset(elements.get('fileset').get(0), function (contents, path, dir) {
        var compiler = new Compiler(),
            options = new CompilerOptions(),
            sourceFile = JSSourceFile.fromFile(new File(dir, path));

        CompilationLevel.SIMPLE_OPTIMIZATIONS.setOptionsForCompilationLevel(options);

        compiler.compile(JSSourceFile.fromCode('externs.js', ''), sourceFile, options);

        tools.writeStringToFile(compiler.toSource(), dir, path);
    });

})(project, attributes, elements, require);