From 716c2d6b14868a838f8ef72577fea79a5a3a674d Mon Sep 17 00:00:00 2001 From: Alain Dumesny Date: Sun, 9 Aug 2020 20:34:32 -0700 Subject: [PATCH 1/2] TS: support for ES6 modules * use webpack to bundle gridstack.all.js (all inclusive, works in browsers) * use tsc to compile each .TS into ES6 modules verified that you can now do this in a sample app import { GridStack } from 'gridstack'; import 'gridstack/dist/gridstack.css'; var grid = GridStack.init(); --- Gruntfile.js | 12 +++++------- demo/two.html | 7 +------ package.json | 10 ++++++---- src/gridstack.ts | 11 +++++++++++ src/index.ts | 15 --------------- src/jq/gridstack-dd-jqueryui.ts | 9 +++++---- tsconfig.json | 8 +++++--- webpack.config.js | 10 +--------- yarn.lock | 17 ++++++++++++----- 9 files changed, 46 insertions(+), 53 deletions(-) delete mode 100644 src/index.ts diff --git a/Gruntfile.js b/Gruntfile.js index 27ea7f1c9..b1e6813cb 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,6 +1,6 @@ module.exports = function(grunt) { grunt.loadNpmTasks('grunt-sass'); - // grunt.loadNpmTasks('grunt-contrib-cssmin'); + grunt.loadNpmTasks('grunt-contrib-cssmin'); grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-eslint'); @@ -24,7 +24,6 @@ module.exports = function(grunt) { } } }, - /* very little gain cssmin: { dist: { options: { @@ -37,7 +36,6 @@ module.exports = function(grunt) { } } }, - */ copy: { dist: { files: { @@ -58,8 +56,8 @@ module.exports = function(grunt) { }, dist: { files: { - 'dist/jq/jquery.min.js': 'src/jq/jquery.js', - 'dist/jq/jquery-ui.min.js': 'src/jq/jquery-ui.js', + 'dist/jq/jquery.js': 'src/jq/jquery.js', + 'dist/jq/jquery-ui.js': 'src/jq/jquery-ui.js', /* 'dist/jq/gridstack-dd-jqueryui.min.js': 'dist/jq/gridstack-dd-jqueryui.js', 'dist/gridstack-dd.min.js': 'dist/gridstack-dd.js', @@ -84,7 +82,7 @@ module.exports = function(grunt) { }, styles: { files: ['src/*.scss'], - tasks: ['sass'/*, 'cssmin'*/], + tasks: ['sass', 'cssmin'], options: { }, } @@ -118,6 +116,6 @@ module.exports = function(grunt) { }); grunt.registerTask('lint', ['eslint']); - grunt.registerTask('default', ['sass', /*'cssmin', 'eslint',*/ 'copy', 'uglify']); + grunt.registerTask('default', ['sass', 'cssmin', /*'eslint',*/ 'copy', 'uglify']); grunt.registerTask('e2e-test', ['connect', 'protractor_webdriver', 'protractor']); }; diff --git a/demo/two.html b/demo/two.html index e646cd4dc..2cb819f11 100644 --- a/demo/two.html +++ b/demo/two.html @@ -11,12 +11,6 @@ -