tom-select
tom-select copied to clipboard
Sass error since tom-select v2.2.0
When using the provided CSS, the error is thrown:
Error: "var(--ts-pr-min)" is not a number for `max'
on line 26:18 of node_modules/tom-select/dist/css/tom-select.default.css, in function `max`
from line 26:18 of node_modules/tom-select/dist/css/tom-select.default.css
There was a try to fix this in https://github.com/orchidjs/tom-select/pull/479 but it still does not work.
I'm using Ruby on Rails with sass processor (sassc-rails) and trying to @import dist/css/tom-select.default.css
Fixes are described here: https://github.com/sass/sass/issues/2849
Same problem for me on Ruby on Rails 7
Any workarounds or update coming?
I'm doing this at production.rb
for now.
- config.assets.css_compressor = :sass
+ config.assets.css_compressor = nil
@morgoth
Any chance you can lock your Tom Select version to 2.1.0 and import the SCSS files not the pre-processed versions and let me know if that works?
I'm starting to get the impression importing already processed CSS from the dist
folder then running it back through the sassc-rails compiler is problematic, and not just for this lib.
@MatthewKennedy Yes, it works on 2.1.0
My setup is:
# initializer file
Rails.application.config.assets.paths << Rails.root.join("node_modules/tom-select/dist/scss/")
and then in the scss file:
@import "tom-select.default";
I tried upgrading this way to 2.2.2 and I no longer get sass error, but the javascript one this time: TypeError: tom_select__WEBPACK_IMPORTED_MODULE_1__.default is not a constructor
Got the same error as above (for 2.2.2): TypeError: tom_select__WEBPACK_IMPORTED_MODULE_0__.default is not a constructor when tried to create stimulus controller for tomselect
import TomSelect from 'tom-select'
import { Controller } from '@hotwired/stimulus'
export default class extends Controller {
connect() {
let config = { maxOptions: null }
this.select = new TomSelect(el, config)
}
disconnect() {
if (this.select) {
this.select.destroy()
}
}
}
This issue has not been active in 120 days and has been marked "stale". Remove stale label or comment or this will be closed in 15 days
Same issue here: Uncaught TypeError: tom_select_1.default is not a constructor
Any idea what's the issue here?