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 - Ruby on Rails Tutorial
From the course: Ruby on Rails 6: Controllers and Views
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.…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
Add style sheets to view templates7m 56s
-
(Locked)
Use static image assets5m 9s
-
(Locked)
Use images as CSS backgrounds4m 19s
-
(Locked)
About JavaScript in Ruby on Rails3m 50s
-
(Locked)
Manage JavaScript with Webpacker4m 2s
-
(Locked)
Configure asset pipeline for JavaScript5m 7s
-
(Locked)
Manage JavaScript with asset pipeline3m 37s
-
-
-