Skip to content

Instantly share code, notes, and snippets.

@FlowerWrong
Created September 12, 2020 06:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FlowerWrong/fc08c122f8affd2a8f7c13468446178b to your computer and use it in GitHub Desktop.
Save FlowerWrong/fc08c122f8affd2a8f7c13468446178b to your computer and use it in GitHub Desktop.
rails 6 webpacker gridstack.js
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