require(['css!style.css','ejs!template.ejs'], function(){})
I probably don't have to say anymore about this.
When developing components, it's likely that a single component will have several parts, including:
- templates
- styles
- tests
It's best for development to keep them all in one place, within a folder that contains the name of the component like:
app\
component\
component.js
component.css
template1.ejs
template2.ejs
component_test.js
However, this is awkward when using AMD. You have to either:
- name
app/component
app/component/component
, which is not how you'd want to share it - configure
app/component
to sit inapp/component/component.js
and incomponent.js
make sure there's adefine('app/component', .... )
.
[]
are only necessary when providing a definition, often this can, and should be determined from the path.
require(['style.css','template.ejs'], function(){})
For odd extensions, an object is accepted:
require([{type: "css", id: "my.style"}], function(){})
require(["foo/bar"])
Looks up in foo/bar/bar.js
require("foo/bar", function(){})
define("abc/def", function(){}) // definition is implied by path