Git Product home page Git Product logo

coffeescript-concat's People

Contributors

akolpakov avatar christoph-d avatar devoxel avatar fairfieldt avatar freethenation avatar georf avatar haripo avatar provegard avatar rz-robsn avatar unquietcode avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

coffeescript-concat's Issues

Wrong Directory Error (Windows)

I cannot include a folder with a name longer than one letter.

I try to include to folder coffee\maze and the folder c does not exists ... that is true, it's name coffee, not c.

If I rename the folder 'coffee' to 'c' then the error is the same, just with m instead of c.

[some path]>coffeescript-concat -I coffee\maze test.coffee -o main.coffee 

fs.js:654
  return binding.readdir(pathModule._makeLong(path));
                 ^
Error: ENOENT, no such file or directory '[some path]\c'
    at Object.fs.readdirSync (fs.js:654:18)
    at [NPM-Path]\node_modules\coffeescript-concat\coffeescript-concat:60:19
    at mapDependencies ([NPM-Path]\node_modules\coffeescript-concat\coffeescript-concat:67:9)
    at concatenate ([NPM-Path]\node_modules\coffeescript-concat\coffeescript-concat:202:12)
    at Object.<anonymous> ([NPM-Path]\node_modules\coffeescript-concat\coffeescript-concat:224:3)
    at Object.<anonymous> ([NPM-Path]\node_modules\coffeescript-concat\coffeescript-concat:226:4)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)

External dependencies

My coffeescript application depends on jquery and batman.js that are inserted as separate files.
So my classes extend different Batman.Object with Batman's naming rules i.e:

class Chat.Message extends Batman.Model

When I concat them with coffeescript-concat I get tones of "Error: couldn't find needed class: Batman"

What should I do to switch that warnings off as I do not want to concat my files with batman.js?

Q: Can I use a main file to include other scripts?

I didn't find any doc, so I don't know how handles paths.

How to make it work?

I want to use something like this files:

main.coffee

#= require <ClassA.coffee>
#= require <ClassB.coffee>
#= require <NamespaceX/main.coffee>
# ...

NamespaceX/main.coffee

# 
#= require <ClassA.coffee>
#= require <ClassB.coffee>
# ...

In a tree like:

  • NamespaceX
    • ClassA.coffee
    • ClassB.coffee
    • main.coffee
  • ClassA.coffee
  • ClassB.coffee
  • main.coffee

Then run something like:

coffeescript-concat main.coffee

...and compiles together.

In #= require <FILE>... FILE should be full path or relative to file?

Output is appended rather than overwriten

Using coffeescript-concat with phpstorm on a filewatcher the output is appended to rather than overwritten. Is this intended functionality? How can I overwrite?

I'm just using the following args : '-R $FileDir$ -o compiled.coffee'

coffeescript map support

It would be nice to have coffeescript maps supports, I mean to be able to get separate files on debugging of the concatenated one.

External JS support?

I'm trying to use this with Backbone.js and have some of my CoffeeScript models extend Backbone.Model. But if I do this, I get something like "Error: couldn't find needed class: Backbone". It'd be nice to support this use case and somehow assume that Backbone.Model would be defined ahead of time. Either flat out ignore "couldn't find this class" errors, or potentially pass a whitelist of classes that CoffeeScript-Concat should assume will already be defined.

Thanks!

"coffeescript-concat -I ./src/somedir -o ./src/foo.coffee bar.coffee otherbar.coffee" fails

The failure is because mapDependencies(sourceFiles, searchDirectories) in cofeescript-concat.coffee line 82 expects searchDirectories to be an array. But if you only pass a single include dir then searchDirectories will be a string instead. This causes "fs.readdirSync(dir)" on line 85 to fail because dir will be a single character from the string instead of a valid path.

This is for v1.0.2 installed via npm on Ubuntu 11.04

Workaround:
pass multiple include dirs: "coffeescript-concat -I ./src/somedir -I /src/dummydir -o ./src/foo.coffee input.coffee another_input.coffee"

Real Fix:
include a check of searchDirectories' type inside mapDirectories. Something like this in coffeescript-concat.coffee lines 85-89

    sdtype = typeof searchDirectories
    switch sdtype
        when 'array'
            for dir in searchDirectories
                files = files.concat(path.join(dir, f) for f in fs.readdirSync(dir))
        when 'string'
            files = files.concat(path.join(dir, f) for f in fs.readdirSync(dir))

Here's the raw javascript that I hacked up on my local install (coffeescript-concat, lines 56-83):

    if (typeof (searchDirectories) === 'array') {
      // if more than one include dir then grab everything from all include dirs
      for (_i = 0, _len = searchDirectories.length; _i < _len; _i++) {
        dir = searchDirectories[_i];
        files = files.concat((function() {
          var _j, _len2, _ref, _results;
          _ref = fs.readdirSync(dir);
          _results = [];
          for (_j = 0, _len2 = _ref.length; _j < _len2; _j++) {
            f = _ref[_j];
            _results.push(path.join(dir, f));
          }
          return _results;
        })());
      }
    } else if (typeof (searchDirectories) === 'string') {  
      // if only one include dir was specified then simply grab everything inside there
      files = files.concat ((function () {
        var results = fs.readdirSync (searchDirectories);
        for (var i = 0; i < results.length; i++) {
          results[i] = path.join (searchDirectories, results[i]);
        }
        return results;
      })());
    } else {
      // no include dirs specified, so do nothing
    }

Specific position for requires

For a node project, I would like to have my index.coffee file using to do like such:

#= require <vendor>
#= require <functions>
(($) ->
  #= require <form-elements>
  #= require <main-site>
) jQuery

Unfortunately, instead of going where I expect them to go, they end up at the top of the file - which is the programmed intended action, but not what I am looking for.

I would like to be able not to always write the ready function for all files.

Is there a way to compile/concat coffeescript that can put included files at specific positions, say inside a function?

Requering files with many classes

When I put requere to the file that I want to concat (the file mock.coffee is in the same directory)

=require mock.coffee

I get "Error: couldn't find needed class: mock"

Why does it search for class when I want file to be included? I have several classes inside this file and some of them have compound names, i.e. Chat.Mock

Gulp integration

Does any coffeescript-concat integration with gulp exist?
Or maybe it's better just use gulp-grunt + coffeescript-concat grunt plugin for integration with gulp?

concat use all files from include dir

Hello,

I have the following situation:

classes/FooBar.coffee
#= require Bar
class FooBar extends Bar
  some: () -> console.log(@)
classes/Bar.coffee
class Bar
  someOther: () -> console.log(@)
application.coffee
$(->)

Then I use this command: coffeescript-concat -I classes/ application.coffee

class Bar
  someOther: () -> console.log(@)

class FooBar extends Bar
  some: () -> console.log(@)
$(()->)

Because I have no require statement in application.coffee, I want to have this result:

$(()->)

License?

Hi, I'm interested in using your project, is there a license for the code?

License

coffeescript-concat lacks a license. If it's open-source (which I assume it is) make it obvious! I'm working on a few features, namely adding watch support, so it would be cool if I could merge them back into coffescript-concat when I'm done!

Readme for running coffeescript-concat is incorrect?

Should it instead say the following?


Using coffeescript-concat:

Using npm:
$ npm install -g coffeescript-concat
$ coffeescript-concat -I /my/include/directory -I includeDir2 A.coffee B.coffee -o output.coffee

Using CoffeeScript directly:
$ coffee coffeescript-concat.coffee -I /my/include/directory -I includeDir2 A.coffee B.coffee -o output.coffee
This will preprocess and concatenate T

Couldn't find classes/file

I've installed node.js, coffee, and underscore, but when I run coffee coffeescript-concat.coffee I get the following error:

Error: couldn't find needed class: ClassName
Error: couldn't find needed class: directives
Error: couldn't find needed file: FileName

Google's not helping on what's missing unfortunately. I'm guessing something obvious?

Include directories (-I) should not be required

The 'mapDependencies' method does not require search directories, but the command line arguments are fixed to enforce that at least 2 args are required. Basically, in the simple case when I am passing in two files I should not have to specify an include directory as well.

See pull request: #9

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.