cloudchen / grunt-template-jasmine-requirejs

RequireJS template for grunt-contrib-jasmine task
111 stars 97 forks source link

Fix loaderPlugin #54

Closed AsaAyers closed 10 years ago

AsaAyers commented 10 years ago

It looks like at some point the module names were moved from context out to context.scripts.

It's not clear to me how to write a test for this. I tried copying require-baseurl into require-loader, but I can't get the new test to run with no modifications.

Running "jasmine:require-loader" (jasmine) task
Testing jasmine specs via phantom
>> Error: scripterror: Illegal path or script error: ['app'] at
>> _SpecRunner.html:21 
>> .grunt/grunt-contrib-jasmine/require.js:12 v
>> .grunt/grunt-contrib-jasmine/require.js:29 

output from: https://github.com/AsaAyers/grunt-template-jasmine-requirejs/commit/af02ba802f72cf995e29c82597fb79ca01b000e9

cloudchen commented 10 years ago

What does it do? I even don't know what it is. Probably, it can be removed completely I think. @jsoverson, do you know that?

AsaAyers commented 10 years ago

To work with CoffeeScript I need all of the modules prefixed with cs!.

What was already here is an extremely naive implementation that assumes all of the files will use the same loader. The long term solution should be to examine the filenames and use appropriate loaders, but I simply fixed what was already implemented.

cloudchen commented 10 years ago

code works fine. but this functionality looks weird. Don't you think coffeescript source file should be preprocessed before this task?

AsaAyers commented 10 years ago

No, RequireJS has a plugin called require-cs that compiles them on the fly so you don't have to trash you project with a bunch of javascript files. It also works with RequireJS's optimizer so it converts all of your CoffeeScript files into one Javascript file for deployment.