Skip to content

Instantly share code, notes, and snippets.

View 123ish's full-sized avatar

123ish LLC 123ish

View GitHub Profile
@123ish
123ish / show.amp.erb
Created July 9, 2020 01:48 — forked from kevinhq/show.amp.erb
Create AMP in Rails powered website - show.amp.erb
# app/views/amp/samples/show.amp.erb
# write your HTML for AMP page here.
@123ish
123ish / application.amp.erb
Created July 9, 2020 01:49 — forked from kevinhq/application.amp.erb
Create AMP in Rails powered website - application.amp.erb
# app/views/amp/layouts/application.amp.erb
<!DOCTYPE html>
<html amp lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no"/>
<!-- add/remove ampproject.org scripts as you need it -->
<script async src="https://cdn.ampproject.org/v0.js"></script>
<script async custom-element="amp-form" src="https://cdn.ampproject.org/v0/amp-form-0.1.js"></script>
@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>
@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 / 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 / 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 / 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 / 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 / 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 / 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;