Skip to content

Commit

Permalink
remove sassc/sprockets dependencies.
Browse files Browse the repository at this point in the history
add propshaft + css/js-bundling-rails instead
  • Loading branch information
langalex committed Dec 17, 2024
1 parent 11f3619 commit 43d88d9
Show file tree
Hide file tree
Showing 20 changed files with 563 additions and 12,990 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,8 @@ coverage/
/storage
db/cms_fixtures/test-site/
.idea

/app/assets/builds/*
!/app/assets/builds/.keep

/node_modules
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,11 @@ gem 'rails', '~> 7.2'
group :development, :test do
gem 'autoprefixer-rails', '~> 10.4.16.0'
gem 'byebug', '~> 11.1.0', platforms: %i[mri mingw x64_mingw]
gem 'cssbundling-rails', '~> 1.4.1'
gem 'gem-release'
gem 'image_processing', '>= 1.12.0'
gem 'jsbundling-rails', '~> 1.3.1'
gem 'propshaft', '~> 1.1.0'
gem 'sqlite3', '~> 1.6.7'
# gem 'mysql2', '~> 0.5'
# gem 'pg', '~> 1.5.4'
Expand Down
3 changes: 3 additions & 0 deletions Procfile.dev
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
web: env RUBY_DEBUG_OPEN=true bin/rails server
js: yarn build --watch
css: yarn build:css --watch
Empty file added app/assets/builds/.keep
Empty file.
1 change: 1 addition & 0 deletions app/assets/config/manifest.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
//= link_tree ../builds
63 changes: 29 additions & 34 deletions app/assets/javascripts/comfy/admin/cms/application.js
Original file line number Diff line number Diff line change
@@ -1,39 +1,34 @@
//= require rails-ujs
//= require jquery3
import "@rails/ujs";
import "jquery";

import "../../vendor/sortable.min";
import "../../vendor/bootstrap.bundle.min";
import "../../vendor/diff/diff_match_patch.min";
import "../../vendor/diff/pretty_text_diff";
import "../../vendor/fontawesome";
import "../../vendor/redactor";
import "../../vendor/redactor/filemanager";
import "../../vendor/redactor/imagemanager";
import "../../vendor/redactor/definedlinks";
import "../../vendor/redactor/table";
import "../../vendor/redactor/video";

//= require comfy/vendor/codemirror
//= require comfy/vendor/codemirror/mode/css/css
//= require comfy/vendor/codemirror/mode/htmlmixed/htmlmixed
//= require comfy/vendor/codemirror/mode/javascript/javascript
//= require comfy/vendor/codemirror/mode/markdown/markdown
//= require comfy/vendor/codemirror/mode/xml/xml
//= require comfy/vendor/codemirror/addon/edit/closetag
//= require comfy/vendor/sortable.min
//= require comfy/vendor/bootstrap.bundle.min
//= require comfy/vendor/diff/diff_match_patch.min
//= require comfy/vendor/diff/pretty_text_diff
//= require comfy/vendor/fontawesome
//= require comfy/vendor/redactor
//= require comfy/vendor/redactor/filemanager
//= require comfy/vendor/redactor/imagemanager
//= require comfy/vendor/redactor/definedlinks
//= require comfy/vendor/redactor/table
//= require comfy/vendor/redactor/video
//= require_directory ../../vendor/redactor/i18n/
//= require comfy/vendor/flatpickr.min

import "../../vendor/flatpickr.min";
//= require_directory ../../vendor/flatpickr/i18n/

//= require comfy/admin/cms/base
//= require comfy/admin/cms/categories
//= require comfy/admin/cms/codemirror
//= require comfy/admin/cms/diff
//= require comfy/admin/cms/file_link
//= require comfy/admin/cms/file_upload
//= require comfy/admin/cms/files_modal
//= require comfy/admin/cms/page_fragments
//= require comfy/admin/cms/sortable_list
//= require comfy/admin/cms/slugify
//= require comfy/admin/cms/timepicker
//= require comfy/admin/cms/wysiwyg
import "./base";
import "./categories";
// import "./codemirror";
import "./diff";
import "./file_link";
import "./file_upload";
import "./files_modal";
import "./page_fragments";
import "./sortable_list";
import "./slugify";
import "./timepicker";
import "./wysiwyg";

//= require comfy/admin/cms/custom
import "./custom";
47 changes: 31 additions & 16 deletions app/assets/javascripts/comfy/admin/cms/codemirror.js
Original file line number Diff line number Diff line change
@@ -1,31 +1,46 @@
import { EditorView } from "@codemirror/view";

(() => {
const codeMirrorInstances = [];
window.CMS.codemirror = {
init(root = document) {
for (const textarea of root.querySelectorAll('textarea[data-cms-cm-mode]')) {
const codemirror = CodeMirror.fromTextArea(textarea, {
mode: textarea.dataset.cmsCmMode,
tabSize: 2,
lineWrapping: true,
autoCloseTags: true,
lineNumbers: true,
viewportMargin: Infinity
for (const textarea of root.querySelectorAll(
"textarea[data-cms-cm-mode]"
)) {
const codemirror = new EditorView({
doc: textarea.value,
// extensions: [],
parent: textarea,
});

// const codemirror = CodeMirror.fromTextArea(textarea, {
// mode: textarea.dataset.cmsCmMode,
// tabSize: 2,
// lineWrapping: true,
// autoCloseTags: true,
// lineNumbers: true,
// viewportMargin: Infinity,
// });
codeMirrorInstances.push(codemirror);
}

const tabsRoot = root.id === 'form-fragments' ? root : root.querySelector('#form-fragments');
jQuery(tabsRoot).find('a[data-toggle="tab"]').on('shown.bs.tab', () => {
for (const codemirror of codeMirrorInstances) {
codemirror.refresh();
}
});
const tabsRoot =
root.id === "form-fragments"
? root
: root.querySelector("#form-fragments");
jQuery(tabsRoot)
.find('a[data-toggle="tab"]')
.on("shown.bs.tab", () => {
for (const codemirror of codeMirrorInstances) {
codemirror.refresh();
}
});
},
dispose() {
for (const codemirror of codeMirrorInstances) {
codemirror.toTextArea();
}
codeMirrorInstances.length = 0;
}
}
},
};
})();
Loading

0 comments on commit 43d88d9

Please sign in to comment.