How to generate or create Rails app with skip webpacker or how to disable webpacker - shadbox.com

Total Blog Views: 55

Blog Status: publish

Created By: asad_fazlani Created at: 08-05-2021

Tags: shadbox rails ruby on rails webpacker

In this blog we are learning about how to generate or craete rails app with skipping webpacker step by step :

step 1:

Open terminal and use this command for generating rails app 

  rails new myapp --skip-webpack-install  

step 2 :

Open "gemfile" and remove or command webpacker

and add this

 gem 'sass-rails', '>= 5' 

 gem 'sprockets', '~> 4' 

 gem 'sprockets-rails', :require => 'sprockets/railtie'  

After pasting run bundle install

step 3 : 

If you are using sprockets 4, change app/assets/config/manifest.js to:

 //= link_tree ../images 

 //= link application.js 

 //= link application.css 

step 4 :

If you are using sprockets 3, add to config/initializers/assets.rb:

# Rails.application.config.assets.precompile += %w( application.js )

step 5 :

Add this on  app/assets/javascripts/application.js:

//= require rails-ujs

//= require turbolinks

//= require_tree .

step 6:
Change javascript_pack_tag to javascript_include_tag in 
app/views/layout/application.html.erb

Now run your rails app using "rails s"

cchsb

 


asad_fazlani

Technical Blogger at shadbox



Comments



  • swazahmad | almost 4 years ago
    Awesome Information Thanks For Sharing
Buy traffic for your website

About Shadbox

we have the “Get things executed” lifestyle at our place of work. There are not any excuses, no if’s or however’s in our dictionary. committed to navigating the ship of creativity to create cell answers, we resolve the real-lifestyles troubles of our clients and their clients. Our passion for work has won us many awards, year after 12 months.

Services

Downloads