Don't concatenate scripts in dev environment #129

Closed
paulmillr opened this Issue Sep 27, 2011 · 11 comments

Comments

Projects
None yet
9 participants
Owner

paulmillr commented Sep 27, 2011

Problem:

  • app.js has usually ~20k LOC
  • it becomes hard to debug

Resolution:

  • compile coffee files to js, but don't concatenate them in development environment
  • app.js would contain script loader

This would allow us to see prettified stack traces, like: models/model.js:25:3 instead of app.js:21240:16.

Related: #96.
Related: bnolan/capt.

paulmillr was assigned Sep 27, 2011

bnolan commented Sep 27, 2011

Capt does this already. Things to note:

  • .js files must be included in the correct order
  • .js files need to be compiled into a temporary directory somewhere - maybe /build/dev/app/models/model.js
  • Need a watch so that files are auto recompiled when the file changes.
Owner

paulmillr commented Sep 27, 2011

@bnolan ordering of files is set usually via config.yaml, that manages deps etc.

Contributor

omarkhan commented Oct 21, 2011

+1

Contributor

KyleAMathews commented Oct 21, 2011

+1 to this idea. Debugging can be a pain.

Contributor

ivasilov commented Oct 24, 2011

+1

I've changed Stitch to do this by adding a debug config param and serve each module/file individually.
No tests yet, though.

https://github.com/davidelias/stitch/tree/debug-loader

var package = stitch.createPackage({
  debug: true,
  paths: [__dirname + '/lib', __dirname + '/vendor']
});

var app = express.createServer();
app.get('/application.js', package.createServer());
app.get('*', package.createModuleServer()); // serve each module/file
app.listen(3000);
Owner

paulmillr commented Feb 22, 2012

Fixed on features/plugin-api-rewrite branch.

Config API:

  join:
    javascripts:
      'javascripts/app.js': /^app/
      'javascripts/vendor.js': /^vendor/
    stylesheets: 'stylesheets/app.css'
    templates: 'javascripts/app.js'

paulmillr closed this Feb 22, 2012

DallanQ commented May 29, 2012

I'm sorry for not understanding this - I'm new to brunch. Are you suggesting that if I want separate files during development, that I need to create config.coffee with each file listed individually under files.javascripts.joinTo? I can't see a way to specify that I want all coffee files compiled to individual js files, and to have app.js contain a script loader.

Perhaps this is not a big deal if source maps are coming soon?

Owner

paulmillr commented May 29, 2012

You're right. And yes, it ain't a big deal because of them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment