Ruby on Rails - Make Slim the Default Template

后端 未结 2 1497
说谎
说谎 2020-12-15 17:45

I am working on a Ruby on Rails project and am needing to customize default views provided by Gems.

The requirement is to use Slim for template. I understand that ER

相关标签:
2条回答
  • 2020-12-15 18:10

    You can use "slim-rails" gem which is built for generating slim template as default.

    https://github.com/slim-template/slim-rails

    Just replace gem 'slim' by gem 'slim-rails' in your Gemfile.

    0 讨论(0)
  • 2020-12-15 18:11

    In you Gemfile, include

    gem 'slim-rails'
    

    And to generate slim tempage, in config/application.rb add this line of code

    class Application < Rails::Application
    ........................................
    
        config.generators do |g|
          g.template_engine :slim
        end
    end
    
    0 讨论(0)
提交回复
热议问题