Skip to content

Commit

Permalink
Change directory structure & move all app/javascript to app/assets
Browse files Browse the repository at this point in the history
  • Loading branch information
vishnugopal committed Sep 6, 2018
1 parent dfccb12 commit 619eb2e
Show file tree
Hide file tree
Showing 19 changed files with 20 additions and 41 deletions.
File renamed without changes.
4 changes: 4 additions & 0 deletions app/assets/images/index.js.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<% images_glob = Rails.application.root.join('app', 'assets', 'images', '**', '*.{png,jpg,svg}') %>
<% Dir.glob(images_glob).each do |image| %>
import '<%= image %>';
<% end %>
File renamed without changes.
10 changes: 10 additions & 0 deletions app/assets/packs/application.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Application } from "stimulus";
import { definitionsFromContext } from "stimulus/webpack-helpers";

import "../images/index.js.erb";
import "../stylesheets/index.js.erb";
import "../javascripts/index.js";

const application = Application.start();
const context = require.context("javascripts/controllers", true, /.js$/);
application.load(definitionsFromContext(context));
Empty file.
File renamed without changes.
File renamed without changes.
4 changes: 4 additions & 0 deletions app/assets/stylesheets/index.js.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<% css_glob = Rails.application.root.join('app', 'assets', 'stylesheets', '**', '*.{css}') %>
<% Dir.glob(css_glob).each do |file| %>
import '<%= file %>';
<% end %>
File renamed without changes.
4 changes: 0 additions & 4 deletions app/javascript/application/images/index.js.erb

This file was deleted.

15 changes: 0 additions & 15 deletions app/javascript/application/stylesheets/application.css

This file was deleted.

4 changes: 0 additions & 4 deletions app/javascript/application/stylesheets/index.js.erb

This file was deleted.

10 changes: 0 additions & 10 deletions app/javascript/packs/application.js.erb

This file was deleted.

1 change: 0 additions & 1 deletion config/application.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
# require "action_cable/engine"
require "rails/test_unit/railtie"


# Require the gems listed in Gemfile, including any gems
# you've limited to :test, :development, or :production.
Bundler.require(*Rails.groups)
Expand Down
9 changes: 2 additions & 7 deletions config/webpacker.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Note: You must restart bin/webpack-dev-server for changes to take effect

default: &default
source_path: app/javascript
source_path: app/assets
source_entry_path: packs
public_output_path: packs
cache_path: tmp/cache/webpacker
Expand All @@ -16,11 +16,7 @@ default: &default
extensions:
- .erb
- .js
- .sass
- .scss
- .css
- .module.sass
- .module.scss
- .module.css
- .png
- .svg
Expand All @@ -47,11 +43,10 @@ development:
use_local_ip: false
quiet: false
headers:
'Access-Control-Allow-Origin': '*'
"Access-Control-Allow-Origin": "*"
watch_options:
ignored: /node_modules/


test:
<<: *default
compile: true
Expand Down

0 comments on commit 619eb2e

Please sign in to comment.