Skip to content

Instantly share code, notes, and snippets.

View 123ish's full-sized avatar

123ish LLC 123ish

View GitHub Profile
@123ish
123ish / application.js
Created August 15, 2020 18:03 — forked from kevinhq/application.js
Step-by-Step guide on how to move from Sprockets to Webpacker - updated application.js
/* app/javascript/packs/application.js */
require("@rails/ujs").start();
require("@rails/activestorage").start();
require("packs/example1");
require("packs/example2");
require("packs/example3");
@123ish
123ish / example2.js
Created August 15, 2020 18:03 — forked from kevinhq/example2.js
Step-by-Step guide on how to move from Sprockets to Webpacker - packs/example2.js
/* app/javascript/packs/example2.js */
// to call example1 var, you need:
import example1 from './example1';
@123ish
123ish / example1.js
Created August 15, 2020 18:02 — forked from kevinhq/example1.js
Step-by-Step guide on how to move from Sprockets to Webpacker - packs/example1.js
/* app/javascript/packs/example1.js */
var example1 = function doSomething() {
// Your codes here
}
export default example1;
@123ish
123ish / application.js
Created August 15, 2020 18:02 — forked from kevinhq/application.js
Step-by-Step guide on how to move from Sprockets to Webpacker - application.js
/* app/javascript/packs/application.js */
require("@rails/ujs").start();
require("@rails/activestorage").start();
@123ish
123ish / production.js
Created August 15, 2020 18:01 — forked from kevinhq/production.js
Step-by-Step guide on how to move from Sprockets to Webpacker - production.js
// config/webpack/production.js
process.env.NODE_ENV = 'production';
const environment = require('./environment');
module.exports = environment.toWebpackConfig();
@123ish
123ish / erb.js
Created August 15, 2020 18:01 — forked from kevinhq/erb.js
Step-by-Step guide on how to move from Sprockets to Webpacker - erb.js
// config/webpack/loaders/erb.js
module.exports = {
test: /\.erb$/,
enforce: 'pre',
exclude: /node_modules/,
use: [{
loader: 'rails-erb-loader',
options: {
runner: (/^win/.test(process.platform) ? 'ruby ' : '') + 'bin/rails runner'
}
@123ish
123ish / custom_loader.js
Created August 15, 2020 18:00 — forked from kevinhq/custom_loader.js
Step-by-Step guide on how to move from Sprockets to Webpacker - custom_loader.js
// config/webpack/loaders/custom_loaders.js
module.exports = {
test: /\.ya?ml$/,
loaders: ['json-loader', 'yaml-loader']
};
@123ish
123ish / Gemfile
Created August 15, 2020 17:59 — forked from kevinhq/Gemfile
Step-by-Step guide on how to move from Sprockets to Webpacker - Gemfile
gem "webpacker"
@123ish
123ish / application.js
Created August 1, 2020 16:27 — forked from kevinhq/application.js
How to migrate from jquery-ujs to rails-ujs - replace
- //= jquery_ujs
+ //= require rails-ujs
@123ish
123ish / example.html.erb
Created August 1, 2020 16:26 — forked from kevinhq/example.html.erb
How to migrate from jquery-ujs to rails-ujs - step 1
<script src="/assets/jquery.js"></script>
<script src="/assets/jquery_ujs.js"></script>