Skip to content
This repository was archived by the owner on May 13, 2025. It is now read-only.

Commit 4bf3a61

Browse files
authored
Merge pull request #8 from TwilioDevEd/fix-assets
Move js assets to javascript folder
2 parents bf6de22 + 4a8b481 commit 4bf3a61

File tree

14 files changed

+56
-44
lines changed

14 files changed

+56
-44
lines changed

app/assets/config/manifest.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,2 @@
11
//= link_tree ../images
2-
//= link_directory ../javascripts .js
32
//= link_directory ../stylesheets .css

app/assets/javascripts/application.js

Lines changed: 0 additions & 16 deletions
This file was deleted.

app/assets/javascripts/channels/.keep

Whitespace-only changes.

app/assets/javascripts/main.coffee

Lines changed: 0 additions & 3 deletions
This file was deleted.

app/assets/javascripts/sessions.coffee

Lines changed: 0 additions & 3 deletions
This file was deleted.

app/assets/javascripts/users.coffee

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,7 @@
1+
12
// Action Cable provides the framework to deal with WebSockets in Rails.
23
// You can generate new channels where WebSocket features live using the `rails generate channel` command.
3-
//
4-
//= require action_cable
5-
//= require_self
6-
//= require_tree ./channels
74

8-
(function() {
9-
this.App || (this.App = {});
5+
import { createConsumer } from "@rails/actioncable"
106

11-
App.cable = ActionCable.createConsumer();
12-
13-
}).call(this);
7+
export default createConsumer()

app/javascript/channels/index.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
// Load all the channels within this directory and all subdirectories.
3+
// Channel files must be named *_channel.js.
4+
5+
const channels = require.context('.', true, /_channel\.js$/)
6+
channels.keys().forEach(channels)
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
/* eslint no-console:0 */
21
// This file is automatically compiled by Webpack, along with any other files
32
// present in this directory. You're encouraged to place your actual application logic in
43
// a relevant structure within app/javascript and only use these pack files to reference
54
// that code so it'll be compiled.
6-
//
7-
// To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate
8-
// layout file, like app/views/layouts/application.html.erb
95

6+
require("@rails/ujs").start()
7+
require("turbolinks").start()
8+
require("@rails/activestorage").start()
9+
require("channels")
10+
import './intlTelInput.js'
11+
import './utils.js'
1012

1113
// Uncomment to copy all static images under ../images to the output folder and reference
1214
// them with the image_pack_tag helper in views (e.g <%= image_pack_tag 'rails.png' %>)
1315
// or the `imagePath` JavaScript helper below.
1416
//
1517
// const images = require.context('../images', true)
1618
// const imagePath = (name) => images(name, true)
17-
18-
console.log('Hello World from Webpacker')

app/assets/javascripts/intlTelInput.js renamed to app/javascript/packs/intlTelInput.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
// wrap in UMD
88
(function(factory) {
99
var intlTelInput = factory(window, document);
10-
if (typeof module === "object" && module.exports) module.exports = intlTelInput; else window.intlTelInput = intlTelInput;
10+
window.intlTelInput = intlTelInput;
1111
})(function(window, document, undefined) {
1212
"use strict";
1313
return function() {

0 commit comments

Comments
 (0)