Git Product home page Git Product logo

coffee-views's Issues

load order bug

If the coffee-views gem is put before the slim gem in the Gemfile the filter does not register.

This should either be documented or fixed :)

Code generation bug

The following code produces strange javascript:

Coffeescript:

test =
  "<%='key'%>": <%='value'%>

Generated code:

test = {
      "`"key"`": "value"
    };

Expected code:

test = {
      "key": "value"
    };

Also using "raw" output does not work, it produces:

test = {
      "`key`": "value"
    };

Parsing bug

The following code generates a parse error:

    test =
      "<%="key"%>": <%='value'%>

NameError: uninitialized constant Slim::Embedded::ERBEngine

After a recent bundle update, I'm getting this:

	 5: from /usr/local/lib/ruby/gems/2.5.0/gems/coffee-views-0.2.0/lib/coffee_views/slim.rb:5:in `block in <main>'
	 4: from /usr/local/lib/ruby/gems/2.5.0/gems/coffee-views-0.2.0/lib/coffee_views/slim.rb:6:in `<module:CoffeeViews>'
	 3: from /usr/local/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/active_support.rb:42:in `load_missing_constant'
	 2: from /usr/local/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/active_support.rb:53:in `rescue in load_missing_constant'
	 1: from /usr/local/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/active_support.rb:8:in `without_bootsnap_cache'
/usr/local/lib/ruby/gems/2.5.0/gems/bootsnap-1.3.1/lib/bootsnap/load_path_cache/core_ext/active_support.rb:53:in `block in load_missing_constant': uninitialized constant Slim::Embedded::ERBEngine (NameError)

Any ideas?

Rails 6 compatibility

Unfortunately, we had this old gem in a application, which we upgraded from 5.2 to 6.0.

Due to the same issue described in rspec/rspec-rails#2086 we monkey patched coffee-views to make it work again. Feel free to implement it, if you need it.

# Monkey patch for rails 6.
# The fix was adopted from the fix by rspec.
# https://github.com/rspec/rspec-rails/issues/2086
# https://github.com/rails/rails/commit/28f88e0074f473f58c2d3fd54cb3daff81027c12#diff-562906215bf781788ec5aaf37e958cb8
# https://github.com/yury/coffee-views/blob/master/lib/coffee_views/rails.rb#L29
CoffeeViews::Rails::TemplateHandler.class_eval do
  def self.call(template)
    source = compile_coffee(template.source)
    template.instance_variable_set :@source, source

    erb_handler.call(template, _source = source)
  end
end

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.