I am using grunt-requirejs and my application structure looks like this:
site/
dev/
index.html
config.coffee
app.coffee
etc.
srv_dev/
index.html
config.js
app.js
etc.
dist/
node_modules/
Gruntfile.coffee
When I run grunt dev, the files are compiled into js from coffee, among other tasks, and copied from dev / to srv_dev / and then sent from there.
My task grunt distdoes what devserves, and then runs the task requirejs, which, I hope, should compile / merge all major Depending my application, but still allow calls require(somevar)and defineto start later. Basically, I have some parts of my one-page application, which does not load until the user clicks on the link that fires when requrire()and is called define().
... myuntjs grunt :
requirejs:
options:
baseUrl: './'
mainConfigFile: 'srv_dev/config.js'
dist:
options:
out: 'dist/script.js'
Error: Error: Missing either a "name", "include" or "modules" option
-, , . tkellen in almond.js - , , - (). : " , , ". , :
requirejs:
options:
baseUrl: './'
name: 'srv_dev/config.js'
dist:
options:
out: 'dist/script.js'
Error: ENOENT, no such file or directory >> '/Users/user/Desktop/project/site/app.js'
, config.js, , config, baseUrl config.ht.
baseUrl './srv_dev' config requirejs, config.js. , . , grunt , config.js, , .
!!!
config.coffee
config =
baseUrl: './'
paths:
text : '/components/requirejs-plugins/lib/text'
json : '/components/requirejs-plugins/src/json'
jquery : '/components/jquery/jquery'
bootstrap : '/components/bootstrap/dist/js/bootstrap'
lodash : '/components/lodash/dist/lodash'
backbone : '/components/backbone/backbone'
marionette : '/components/marionette/lib/backbone.marionette.min'
handlebars : '/components/handlebars/handlebars'
prism : '/components/customPrism/prism'
coffeescript : '/components/coffee-script/extras/coffee-script'
app : '/app/app'
appSettings : '/app/appSettings'
AppController : '/app/AppController'
AppRouter : '/app/AppRouter'
postMasterRecord : '/posts/postMasterRecord'
util : '/scripts/util'
templates : '/templates'
handlebarsHelpers: '/scripts/handlebarsHelpers'
shim:
bootstrap:
deps: ['jquery']
backbone:
deps: ['lodash', 'jquery']
exports: 'Backbone'
marionette:
deps: ['backbone', 'lodash', 'jquery']
exports : 'Marionette'
handlebars:
exports: 'Handlebars'
templates:
deps: ['handlebars']
app:
deps: [
'marionette'
'bootstrap'
'handlebars'
'templates'
]
require.config(config)
require(['app'])