コード例 #1
0
ファイル: snockets.js プロジェクト: iamlacroix/grunt-snockets
  grunt.registerMultiTask('snockets', 'Building js files with snockets.js.', function() {
    // It doesn't run with empty src and dest parameters.
    if (typeof this.data.src === 'undefined' ||
        typeof this.data.dest === 'undefined') {
      grunt.log.error('Missing Options: src and dest options necessary');
      return false;
    }

    var minify = (this.data.minify === false ? false : true);

    if (fs.existsSync(path.resolve(this.data.src))) {
      try {
        js = snockets.getConcatenation(this.data.src, {async: false, minify: minify});

        if (this.data.banner)
          js = this.data.banner + '\n' + js;

        grunt.file.write(path.resolve(this.data.dest));
        fs.writeFileSync(path.resolve(this.data.dest), js);

        grunt.log.write(this.data.src + ' snocket to ' + this.data.dest + '\n');
        return true;
      } catch (e) {
        grunt.log.error(e);
        return false;
      }
    } else {
      grunt.log.error('Missing File: ' + this.data.src);
      return false;
    }
  });
コード例 #2
0
ファイル: coffee.js プロジェクト: aabril/roots
  files.forEach(function(file){

    try {
      var helper = new Helper(file)
      var compiled_js = snockets.getConcatenation(helper.file_path, { async: false });
      helper.write(compiled_js)
    } catch (err) {
      error = err;
    }
    
  });
コード例 #3
0
ファイル: snockets.js プロジェクト: chakrikodali/barkeep
        grunt.util.async.forEach(js, function (fn, callback) {
            snock.getConcatenation(fn, {minify: options.minify}, function (err, js) {
                if (err) {
                    grunt.fail.fatal(err);
                }
                var combinedFile = outputFilename(fn, options);
                var javascript  = headerFooter(js, options);
                
                grunt.file.write(combinedFile, javascript);

                callback(null);
            });
        }, function(err) {
コード例 #4
0
ファイル: yaac.js プロジェクト: yourcelf/yaac
 ".coffee": function(srcPath, code, callback) {
     callback(null, snockets.getConcatenation(srcPath, {
         async: false, minify: process.env.NODE_ENV == "production"
     }));
 },