requirejs/require-cs

Long time no update

Closed this issue · 6 comments

tiye commented

CoffeeScript is now 1.7.1.

And it's quite complicated to use this plugin comparing to other plugins.

We have updated the plugin to use the newer versions of the compiler.

Could you offer some examples about how it's complicated to use this, and which other plugins offer a simpler interface.

tiye commented

I think I was mostly meaning this:

{
  packages: [
  {
    name: 'cs',
    location: 'require-cs',
    main: 'cs'
  },
  {
    name: 'coffee-script',
    main: 'index'
  }
  ]
}

Well, that is just the way it is. Another approach, which I follow in my projects is actually specifying the cs and coffee-script dependencies in the paths object in the requirejs config:

requirejs.config({
   paths: {
      ...
      cs: '../public/components/require-cs/cs'
      'coffee-script': '../public/components/coffeescript/extras/coffee-script'
      ...
   }
})

Your packages configuration actually does not work for me, I get a Script error for: coffee-script/index.

packages: [
  {
    name: 'cs',
    location: 'require-cs',
    main: 'cs'
  },
  {
    name: 'coffee-script',
    main: 'index'
  }
]

This is the configuration that works for me (using CoffeeScript 1.7.1):

require.config({
  baseUrl: '/bower_components/',
  packages: [
    {
      name: 'cs',
      location: 'require-cs',
      main: 'cs'
    },
    {
      name: 'coffee-script',
      location: 'coffeescript',
      main: 'extras/coffee-script'
    }
  ]
});
require(['cs!/app/main']);

Thanks for pointing out. I think the README file is outdated on this one point, as coffee-script has been restructured a bit in the past... I'll fix the readme