Automatic coffeescript compilation file location #755

Closed
metalshark opened this Issue Dec 2, 2012 · 5 comments

Comments

Projects
None yet
5 participants

The rules for coffeescript compilation in Gruntfile.js

coffee.compile.files:
'app/scripts/.js': 'app/scripts/__/.coffee'

are counter intuitive compared to the compass sass compilation.

If I put a file in app/scripts/controllers it appears in apps/scripts instead.

Currently I'm specifying each folder individually and using temp/ instead of app/ instead, but it would be nice to have a smaller config.

Member

hemanth commented Dec 2, 2012

#661 realted issue.

Specifying preserve_dirs as true fixes the issue.

// Coffee to JS compilation
coffee: {
  compile: {
    files: {
      'temp/scripts/*.js': 'app/scripts/**/*.coffee',
      'test/spec/*.js': 'test/spec/**/*.coffee'
    }
  },
  options: {
    preserve_dirs: true
  }
},

snostorm commented Dec 4, 2012

I agree something like this makes sense as the default. Why would I want the random compiled .js files dirtying my source directory?

Side note: metalshark's example above moved the file to a temp folder, but the perserve_dirs option seem to be ignored (v0.9.5.) I'll try running the HEAD yeoman versus latest stable to see if that's a new option.

snostorm commented Dec 4, 2012

this did the trick: (warning the test/spec folder definition in the example may not match what you want) #438 (comment)

ghiden commented Feb 12, 2013

I see a strange behavior with 0.9.6.

$ mkdir example
$ cd example
$ yeoman init angular --coffee
...
$ yeoman coffee
Running "coffee:compile" (coffee) task
File app/scripts/app.js created.
File app/scripts/controllers/main.js created.
File test/spec/main.js created.

Done, without errors.
$ mkdir test/spec/services
$ touch test/spec/services/dummy.coffee
$ yeoman coffee
Running "coffee:compile" (coffee) task
File app/scripts/app.js created.
File app/scripts/controllers/main.js created.
File test/spec/controllers/main.js created.
File test/spec/services/dummy.js created.

Done, without errors.

If there are two coffeescript files in two different directories under 'test/spec', js files are generated in the corresponding directories.
But if there is one file, the js file is generated in 'test/spec' directory.

Is this also being fixed in 1.0?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment