coffeescript

error installing coffeescript on mac 10.7.2

社会主义新天地 提交于 2019-12-18 04:08:09
问题 Node and npm are both installed and up to date but keep getting this error when trying to install coffeescript. I am still new to programming so any advice would be greatly appreciated. test-macbook:~ Test$ npm -v 1.1.0-3 test-macbook:~ Test$ node -v v0.6.8 test-macbook:~ Test$ npm install -g coffee-script npm http GET https://registry.npmjs.org/coffee-script npm http 304 https://registry.npmjs.org/coffee-script npm ERR! Could not create /usr/local/lib/node_modules/___coffee-script.npm npm

Is there a way to include file in coffee script?

核能气质少年 提交于 2019-12-18 03:49:21
问题 I'd like to know if there is a way to include a file in a coffee script. Something like #include in C or require in PHP... 回答1: How about coffeescript-concat? coffeescript-concat is a utility that preprocesses and concatenates CoffeeScript source files. It makes it easy to keep your CoffeeScript code in separate units and still run them easily. You can keep your source logically separated without the frustration of putting it all together to run or embed in a web page. Additionally,

Combine source maps of two compilation steps

依然范特西╮ 提交于 2019-12-17 22:45:59
问题 I've got a two-step compilation process for my web application. Firstly, I compile CoffeeScript files into JavaScript files [1]. Then the JavaScript files (both ones that come from CoffeeScript, and external ones, like produced from AngularJS templates by grunt-angular-templates ) are compiled by Google Closure Compiler [2] into a single minimized file. CoffeeScript ---[1]---> JavaScript --[2]--\ \-> AngularJS templates --> JavaScript ----------> single minimized JS file /-> other JS files --

Generating source maps for multiple concatenated javascript files compiled from Coffeescript

核能气质少年 提交于 2019-12-17 22:41:41
问题 Has any one had any success with this? 回答1: I think it's more or less an unsolved problem: https://github.com/jashkenas/coffee-script/issues/2779 . Last meanigingful comment was from jwalton, a month ago. Still, it doesn't seem rocket science to add support for it, so it will probably come soon. Michael Ficarra (creator of CoffeeScript Redux) suggested using https://github.com/michaelficarra/commonjs-everywhere . Two caveats: It only works for bundling CommonJS modules. It uses CoffeeScript

How to add src files in the middle of a pipe

人盡茶涼 提交于 2019-12-17 22:38:38
问题 I want to process some files with 'coffee', add some js files, concat and minify. This does not work, coffee fails on the regular js files: gulp.task 'build-js', -> gulp.src([ "bower_components/mbdev-core/dist/js/db.js" "bower_components/mbdev-core/dist/js/utils.js" "src/js/config/app.coffee" "src/js/config/app-db.coffee" "src/js/accounts/accounts.coffee" "src/js/budget_items/budget_items.coffee" "src/js/line_items/line_items.coffee" "src/js/misc/misc.coffee" "src/js/reports/report_generators

Writing a jquery plugin in coffeescript - how to get “(function($)” and “(jQuery)”?

只谈情不闲聊 提交于 2019-12-17 22:18:17
问题 I am writing a jquery plugin in coffeescript but am not sure how to get the function wrapper part right. My coffeescript starts with this: $.fn.extend({ myplugin: -> @each -> Which creates the javascript with a function wrapper: (function() { $.fn.extend({ myplugin: function() { return this.each(function() { but I want a '$' passed in like this: (function($) { $.fn.extend({ Similar for the ending I have... nothing in particular in coffeescript. I get this in javascript: })(); But would like

what's the least resistance path to debugging mocha tests?

一世执手 提交于 2019-12-17 21:45:17
问题 Edit Nov 2016: Node now has a built in debugger that you can start with --inspect . This answer explains it: https://stackoverflow.com/a/39901169/30946. I'm building a mocha test in coffeescript. Right at the top of the test I have: require "../assets/js/theObject.coffee" debugger ss = new TheObject() I'd like to stop on that debugger line because the object in theObject.coffee isn't being loaded. I'm using node-inspector and it works, sorta. The process that I have is: start node-inspector

Coding clarity of closure for load event

心已入冬 提交于 2019-12-17 21:17:20
问题 Is there are clear way to write this closure for the load event on line #4: for i,item of m # add item once image loaded new_item = $("<img src='#{util.image_url(item, 'large')}' />") new_item.on 'load', ((item) => (=> @add_item(item)))(item) $("#preload-area").append(new_item) 回答1: You want a do loop: When using a JavaScript loop to generate functions, it's common to insert a closure wrapper in order to ensure that loop variables are closed over, and all the generated functions don't just

Chrome Extension Message Passing [duplicate]

我只是一个虾纸丫 提交于 2019-12-17 21:00:02
问题 This question already has answers here : Chrome Extension Message passing: response not sent (3 answers) Closed 5 years ago . I have a chrome extension that's sending a login message: chrome.runtime.sendMessage data, (response) -> debugger if response.api_key $("body").fadeOut 1000, -> window.close() else App.Ui.clearForm() App.Ui.showErrorMessage() However, the callback is never hit: chrome.runtime.onMessage.addListener (request, sender, sendResponse) -> if request and request.action is

JavaScript inheritance and super constructor

て烟熏妆下的殇ゞ 提交于 2019-12-17 20:42:12
问题 I have found and adapted a JavaScript "class" extend function from coffeescript: var extend = (function() { var hasProp = Object.prototype.hasOwnProperty; function ctor(child) { this.constructor = child; } return function(child, parent) { for (var key in parent) { if (hasProp.call(parent, key)) { child[key] = parent[key]; } } ctor.prototype = parent.prototype; child.prototype = new ctor(child); child.__super__ = parent.prototype; // child.prototype.__super__ = parent.prototype; // better?