I'm working on mimosa-traceur Issue #2, which would prevent Traceur from compiling third-party code. In that case, Mimosa should just copy the .js files through to the public folder.
I have the exclude regex option in and working, and Traceur is only being used to compile the files that don't match the exclude pattern.
The problem is that Mimosa is not invoking the copy compiler instead, so I get a bunch of "dependency cannot be found" errors.
I've registered for the init step as well now:
var init = function (mimosaConfig, mimosaOptions, next) {
if (isFileExcludedFromCompilation(mimosaOptions.inputFile, mimosaConfig.traceur.excludeRegex)) {
console.log("UNCLAIMING FILE: " + mimosaOptions.inputFile + " excludeRegex=" + mimosaConfig.traceur.excludeRegex);
mimosaOptions.destinationFile = undefined;
}
return next();
}
var registration = function ( mimosaConfig, register ) {
register(['add','update','buildFile'], 'preCompile', compile, mimosaConfig.extensions.javascript);
register(['add','update','buildFile'], 'init', init, mimosaConfig.extensions.javascript);
Then, in the compile() method, where it loops over each file, I set outputFileText to undefined.
return mimosaOptions.files.forEach(function(file) {
// Check if this file is excluded from compilation
if (isFileExcludedFromCompilation( file.inputFileName, mimosaConfig.traceur.excludeRegex )) {
// Do nothing for files that are excluded from compilation
console.log("SKIPPING COMPILATION OF: " + file.inputFileName);
file.outputFileText = undefined;
The done() method is defined as:
mimosaOptions.files = newFiles;
I wondered if perhaps the copy compiler was running before this module, so I tried changing the build step from preCompile to compile, but it seemed to make no difference.
I just had a brainwave while writing this though. I removed the init processing step and just changed the code above to pass the input text through to the output text:
return mimosaOptions.files.forEach(function(file) {
// Check if this file is excluded from compilation
if (isFileExcludedFromCompilation( file.inputFileName, mimosaConfig.traceur.excludeRegex )) {
// Do nothing for files that are excluded from compilation
console.log("SKIPPING COMPILATION OF: " + file.inputFileName);
file.outputFileText = file.inputFileText;
newFiles.push(file);
done();
}
This worked!
What do you think of doing it that way?