joliss / broccoli-coffee Goto Github PK
View Code? Open in Web Editor NEWCoffeeScript preprocessor for Broccoli
License: MIT License
CoffeeScript preprocessor for Broccoli
License: MIT License
If you update broccoli-persistent-filter
to the latest version 1.2.13
, this will include a fix for a very old bug: kimroen/ember-cli-coffeescript#112
Currently the only extension supported is .coffee (hardcoded).
See also PR #7
CoffeeScript 2.0.0 was just released.
This plug-in appears to pass through all non-coffee files as is, while swapping out coffee files to JavaScript files. I found that surprising, and ended up chaining on another plug-in to strip out all but the JavaScript files.
Is the right idiom that a Broccoli build process should pass essentially all files through a series of plug-ins, each of which transparently passes along everything it doesn't care about? Or is the right idiom that one should use a bunch of plug-ins to process different kinds of things, then merge together the results in at the end? Maybe the former seems more suitable if most plug-ins will make a one to one file mapping? Maybe the latter seems more suitable if most plug-ins will return a tree of substantially different shape than what they accept?
I don't know the answer to the idiom question; but I do know this:
It would be easier to understand while getting started, if plug-ins would state in their documentation what they do with files they don't care about.
If you would rather have a pull request than this wall of text, just say so :-)
Several individuals have come to me with ember-cli build performance issues, of them, broccoli-coffee using broccoli-filter is a common source of problem.
broccoli-persistent-filter supports:
and otherwise is API compatible with broccoli-filter. I would love to upstream the work into broccoli-filter, until that is accepted we should likely update this plugin, or fork a persistent variant. I would prefer not to continue to bifurcate the eco-system.
I'm not sure if this is entirely a broccoli-coffee issue or an ember-cli issue, but I have a case where CoffeeScript doesn't seem to be compiling at the correct times. I recently upgraded an app from ember-cli 0.0.34 to 0.0.40.
When I run ember serve
I get the following error:
Error: Cannot find module '/Users/mikepack/Documents/Work/exercism/server'
This is because my express server is written in CS, not JS. I've converted server/index.js to server/index.coffee, which has worked thus far.
When I convert index.coffee back to index.js, I no longer receive this error, but receive others associated to CS files that ember-cli is looking for as JS files (eg the routes themselves). I also received this error for other CS files like config/application.coffee. Similarly, converting back to JS circumvented the error.
Any ideas on how to approach this problem and retain the CS files? I'm not terribly familiar with broccoli.
Been trying to follow the steps outlined here:
http://blogs.visoftinc.com/2014/07/24/setting-up-ember-cli-with-emblem-and-coffeescript/
and here http://www.ember-cli.com/asset-compilation/#coffeescript
But I always get:
$ ember serve
version: 0.0.44
Livereload server on port 35729
Serving on http://0.0.0.0:4200
ENOENT, no such file or directory '/Users/kmandrup/private/ember-projects/capuchino/tmp/tree_merger-tmp_dest_dir-HMFvzN7o.tmp/capuchino/app.js'
Error: ENOENT, no such file or directory '/Users/kmandrup/private/ember-projects/capuchino/tmp/tree_merger-tmp_dest_dir-HMFvzN7o.tmp/capuchino/app.js'
at Object.fs.statSync (fs.js:695:18)
at addModule (/Users/kmandrup/private/ember-projects/capuchino/node_modules/ember-cli/node_modules/broccoli-es6-concatenator/index.js:83:46)
at addModule (/Users/kmandrup/private/ember-projects/capuchino/node_modules/ember-cli/node_modules/broccoli-es6-concatenator/index.js:126:9)
at /Users/kmandrup/private/ember-projects/capuchino/node_modules/ember-cli/node_modules/broccoli-es6-concatenator/index.js:59:7
at $$$internal$$tryCatch (/Users/kmandrup/private/ember-projects/capuchino/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:470:16)
at $$$internal$$invokeCallback (/Users/kmandrup/private/ember-projects/capuchino/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:482:17)
at $$$internal$$publish (/Users/kmandrup/private/ember-projects/capuchino/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:453:11)
at $$rsvp$asap$$flush (/Users/kmandrup/private/ember-projects/capuchino/node_modules/ember-cli/node_modules/rsvp/dist/rsvp.js:1531:9)
at process._tickCallback (node.js:419:13)
I even tried this... but alas, to no avail ;(
/// Brocfile.js
var filterCoffeeScript = require('broccoli-coffee');
module.exports = filterCoffeeScript(app.toTree());
// package.json
"devDependencies": {
"body-parser": "^1.2.0",
"broccoli-asset-rev": "0.0.17",
"broccoli-coffee": "^0.1.1",
"broccoli-ember-hbs-template-compiler": "^1.6.1",
"ember-cli": "0.0.44",
"ember-cli-ember-data": "0.1.0",
"ember-cli-ic-ajax": "0.1.1",
"ember-cli-inject-live-reload": "^1.0.2",
"ember-cli-qunit": "0.1.0",
"express": "^4.8.5",
"glob": "^4.0.5"
}
I have a local version running which CoffeeLints files as well. Before I submit a pull request, I have a few questions on what you think would be the best implementation:
allow passing in a config file in Brocfile.js, as a sub-setting of the coffeeFilter options:
var coffeelintConfig = require('./coffeelint.json'),
filterCoffeeScript = require('broccoli-coffee');
tree = filterCoffeeScript(tree, {coffeelint: coffeelintConfig});
look for coffeelint.json
in the root of the project automatically
look for coffeelint.json
in the containing folder and parent folders up to the project root
fall back to CoffeeLint defaults
My current implementation does i
and iv
, happy to add or remove options based on feedback before submitting a PR. Any thoughts?
I get the following error trying to install ember-cli-coffeescript.
version not found: [email protected]
After manually forcing a newer version I got it working. Possibly I made some unknown mistake myself, but if not perhaps the dependency could be updated.
https://github.com/sandstrom/broccoli-coffee/commit/57c5b1a1c6e6e104d65e00c39ded70fdb5e7853e
I was curious if there was a blocker for supporting source maps? I'd like to help out, but just wanted to gauge if there is something that I'm not thinking about or unaware of.
Thanks!
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.