jwhitley / requirejs-rails

RequireJS support for your Rails 3 or 4 application
MIT License
592 stars 202 forks source link

css files included with !text are getting stripped from /src/ #272

Closed lisunshiny closed 7 years ago

lisunshiny commented 7 years ago

Hi,

I am currently trying to add the Ace editor library by adding this (https://github.com/ajaxorg/ace/tree/master/lib/ace) folder to vendor/assets/javascripts/ in my Rails app and then calling define(["ace/ace"], function(ace) {"blah"}) on to my project using the requirejs-rails gem. This is also in-line with the implementation instructions here: https://ace.c9.io/#nav=embedding.

Locally, this works fine. However, when I precompile assets for production, specifically on bundle exec rake requirejs:precompile:run_rjs, I'm getting the following error:

   { [Error: ENOENT: no such file or directory, open 'app/tmp/requirejs/dst/ace/css/editor.css']
     errno: -2,
     code: 'ENOENT',
     syscall: 'open',
     path: 'app/tmp/requirejs/dst/ace/css/editor.css',
     moduleTree: 
      [ 'ace/requirejs/text',
        'ace/virtual_renderer',
        'ace/ace',
        'lib/ab-ace',
        'app/file-that-requires-ace' ],
     fileName: app/tmp/requirejs/dst/ace/requirejs/text.js' } }

Two things I noticed are:

Really at a loss here for why these files aren't getting included -- any help would be greatly appreciated!

lisunshiny commented 7 years ago

Oh ok -- I figured this out. For other people trying to use the Ace editor and this gem, I added these regexes to the logical path patterns.

    config.requirejs.logical_path_patterns += [/^ace\/[\w\/]*\w.+\.css$/, /\.snippets$/]
carsomyr commented 7 years ago

@lisunshiny Glad this feature worked out for you!