metaskills / less-rails

:-1: :train: Less.js For Rails

Home Page:http://github.com/metaskills/less-rails

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Imported less files not detected correctly when precompiling assets

fabn opened this issue · comments

I'm using this gem at latest version in a rails 4.2.5 application and the issues mentioned in #79, #88 and #87 is not solved.

Also there is a bigger issue that I get when I deploy the app in heroku and assets are precompiled for production. Here's what happening, I have my main stylesheet named application.css included in layout using <%= stylesheet_link_tag 'application' %>. Its content is more or less the following

/*
 Some vendored assets required using sprockets
 *= require font-awesome
 *= require ...
 *= require ...
 My main file that is a less file
 *= require frontend/main
 */

In app/assets/stylesheets/frontend/main.less I only have less files included using @import

// load bootstrap and overridden styles
@import "bootstrap_and_overrides";
// load individual stylesheets
@import "theme";
@import "forms";
// etc.

Imported files are all in the same folder i.e. app/assets/stylesheets/frontend/{theme,forms,etc}.less

When in development I change an imported file, e.g. theme.less, changes are not detected unless I also change main.less. If I change anything (even an empty line) in main.less the whole application.css gets recompiled.

This is pretty boring in dev but it's already described in other linked issues (and not fixed).

The worst part of it is that if I only change theme.less and I do a deploy on heroku without also changing main.less application file in heroku is not changed at all and the old version is precompiled.

I need to commit some change to main.less in order to get an up to date application.css compiled in production.

My dependencies:

bundle show | grep less
  * less (2.6.0)
  * less-rails (2.7.0)

+1 , Having the same problem with:

  * less (2.6.0)
  * less-rails (2.7.1)

You have to give full path of imported file.
exp.

@import "frontend/theme";
@import "frontend/forms";

@swapnilvathare This works, thank you!

Same here, full path doesn't help.
When I change file name it recompiles.
import "alerts"; -> import "alerts.less"

Tried full path, relative paths, nothing helps.

ℹ️ no activity for year, closing