4

jquery-ui-rails-5.0.5, sass-rails-5.0.3

jquery-ui-rails-5.0+ changed the naming convention for its assets. Instead of jquery.ui.(whatever), it is now jquery-ui/(whatever). The Stylesheets are named (whatever).css. This causes the highly-recommended SASS @import option to fail, while CSS require continues to work.

I have been working on this problem this morning and I tracked down an answer in SASS-RAILS that was said to work, but didn't. It was to include both core and theme with the desired module as follows:

@import 'jquery-ui/core';
@import 'jquery-ui/datepicker';
@import 'jquery-ui/theme';

I wanted to post the answer that I discovered here, in case it helps.

Richard_G
  • 4,700
  • 3
  • 42
  • 78
  • It doesn't look like you followed the directions for [jquery-ui-rails](https://github.com/joliss/jquery-ui-rails). Their instructions do not indicate that the files can be imported that way at all. – cimmanon Jul 11 '15 at 16:59

1 Answers1

7

This works if you also include the file extension:

@import 'jquery-ui/core.css';
@import 'jquery-ui/datepicker.css';
@import 'jquery-ui/theme.css';

Update: I pushed this to Heroku and it did not work there. After some debugging, I determined that I needed to rename them to *.scss, or *.scss.erb in theme's case, before Heroku would process them. I copied them to my own assets to do this.

Richard_G
  • 4,700
  • 3
  • 42
  • 78
  • That doesn't do what you think it does (see: http://stackoverflow.com/questions/7111610/import-regular-css-file-in-scss-file) – cimmanon Jul 11 '15 at 17:03
  • @cimmanon I guess that depends upon what I think it does. grin. It does include the required files using import versus require and does not force me to mix the two. I wouldn't expect that CSS files to be processed the same way the SASS files are processed. In any case, it is simply a refined answer to the question in https://github.com/joliss/jquery-ui-rails/issues/89#issuecomment-120641810 – Richard_G Jul 11 '15 at 18:24
  • Excellent. Worth noting that you may leave off the file extension altogether. In fact, it's probably recommended. – karns May 19 '20 at 14:02