Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Automatic coffeescript compilation file location #755

Closed
metalshark opened this Issue · 5 comments

5 participants

@metalshark

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.

@hemanth
Owner

#661 realted issue.

@metalshark

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

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

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

@ghiden

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
Something went wrong with that request. Please try again.