From the course: Ruby on Rails 6: Controllers and Views

Unlock the full course today

Join today to access over 22,600 courses taught by industry experts or purchase this course individually.

Configure asset pipeline for JavaScript

Configure asset pipeline for JavaScript - Ruby on Rails Tutorial

From the course: Ruby on Rails 6: Controllers and Views

Start my 1-month free trial

Configure asset pipeline for JavaScript

- [Instructor] As I mentioned already, asset pipeline previously handled JavaScript by default, but starting in Rails 6, we have to re-enable it if we want to use it. In this movie, I'm going to show you how. Let's start by getting an overview of the process. The first thing is we need to tell asset pipeline that it should precompile JavaScript again. Then we'll need to create a new directory to house the JavaScript and add a manifest file. We've already seen how that manifest file works for style sheets, we're going to need one for JavaScript. Then we're also going to want to provide a JavaScript compressor for production to use. That just makes our JavaScript smaller and more efficient. And then, as an optional last step, we can disable Webpacker. If you already know that you want to make use of Node.js libraries or a JavaScript framework like React, Angular or Vue, then you may not want to follow along with these steps.…

Contents