Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Check empty string extension #16

Closed
wants to merge 1 commit into from

2 participants

@Enleur

If compile *.js files, they compiling into '.js.js'

@Enleur

I suggest copy .js files instead compile

@avalade avalade referenced this pull request from a commit
@avalade Addressed duplicate .js.js extensions
This fixes the issues:

* avalade/grunt-coffee#16
* avalade/grunt-coffee#14

I've also added in a check where, if you're 
compiling a .js file, it just copies it into
the appropriate directory based upon the 
output directory setting and the preserve 
directories setting.
5b5f1cc
@avalade
Owner

Thanks for the pull request and apologies again for the tardiness of my reply.

I've addressed your concerns in commit 5b5f1cc, I believe. If this will work, let me know and I'll do a release. I'd also like to add you to the contributors, if that's okay.

@Enleur

It works, thanks.

@avalade avalade closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 27, 2012
  1. @Enleur
This page is out of date. Refresh to see the latest.
View
4 tasks/coffee.js
@@ -41,7 +41,7 @@ module.exports = function(grunt) {
js = '';
options = options || {};
- extension = extension ? extension : '.js';
+ extension = typeof extension === "string" ? extension : '.js';
if( destPath && options.preserve_dirs ){
var dirname = path.dirname(src);
@@ -54,7 +54,7 @@ module.exports = function(grunt) {
}
var dest = path.join(destPath, path.basename(src, '.coffee') + extension);
-
+
if( options.bare !== false ) {
options.bare = true;
}
View
8 test/coffee_test.js
@@ -25,6 +25,7 @@ fs.existsSync = fs.existsSync ? fs.existsSync : path.existsSync;
*/
var src = 'test/fixtures/hello_world.coffee';
+var srcJs = 'test/fixtures/empty_extension.js';
var outputFolder = 'tmp/js';
var expectedJSFile = 'test/fixtures/hello_world.js';
@@ -128,5 +129,12 @@ exports['coffee'] = {
grunt.helper('coffee', [src], outputFolder, {}, '.coffee.js');
test.ok(fs.existsSync(path.join(outputFolder, "hello_world.coffee.js")));
test.done();
+ },
+
+ 'helper-empty-string-extension': function(test) {
+ test.expect(1);
+ grunt.helper('coffee', [srcJs], outputFolder, {}, '');
+ test.ok(fs.existsSync(path.join(outputFolder, "empty_extension.js")));
+ test.done();
}
};
View
1  test/fixtures/empty_extension.js
@@ -0,0 +1 @@
+console.log("Hello JavaScript!");
Something went wrong with that request. Please try again.