Created
September 12, 2020 06:12
-
-
Save FlowerWrong/fc08c122f8affd2a8f7c13468446178b to your computer and use it in GitHub Desktop.
rails 6 webpacker gridstack.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require("@rails/ujs").start() | |
require("turbolinks").start() | |
require("@rails/activestorage").start() | |
require("channels") | |
import $ from "jquery" // yarn add jquery | |
// yarn add gridstack | |
import "gridstack/dist/jq/jquery-ui" | |
import 'gridstack/dist/gridstack-poly'; // optional IE support | |
import { | |
GridStack | |
} from 'gridstack'; | |
import 'gridstack/dist/jq/gridstack-dd-jqueryui'; // remove the ts version and del these lines | |
// const $ = require("./jquery"); | |
// exports.$ = $; | |
// __export(require("./jquery-ui")); | |
import 'gridstack/dist/gridstack.css'; | |
$(document).on('turbolinks:load', function () { | |
var grid = GridStack.init(); | |
grid.addWidget('<div><div class="grid-stack-item-content">Item 1</div></div>', { | |
width: 2 | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment