0

My Eclipse project uses Sass. When running in debug mode, sass:watch (configured per this article) correctly polls for changes to *.scss files, compiles them into CSS and places them in the target directory. However, these changes are not reflected on the page, and inspecting the page using Chrome developer tools shows the new CSS is not picked up.

Using another (CSS-only) project works as expected: any change to CSS is copied to target directory, and a refresh of the page reflects the proper change.

I ran across a similar issue someone had using LESS. Unlike that situation, though, even changing the target CSS directly, the change is not reflected in the browser.

I can't be the only person debugging Sass/CSS in Eclipse, but I can't find any info on this problem.

Any ideas on how to fix this?

EDIT: SCSS is being compiled to CSS and copied to the target build directory, but not into the Tomcat deployment where the code is running. As I've said, this is not an issue with CSS-based projects, only with this where it's a compiled file.

Thug
  • 23
  • 1
  • 6
  • 1
    If the CSS is complied properly as you say, then the issue is checking the URL to the CSS, and ensuring it's loading and not getting cached by the browser. I often have to clear / refresh cache when developing using SASS / CSS watchers. – random_user_name Jun 12 '18 at 17:41
  • I've tried clearing cache + hard refresh to no avail. – Thug Jun 12 '18 at 18:45
  • Is the CSS url correct? That's a huge component (trust me, it happens to the best of us!) – random_user_name Jun 12 '18 at 21:12
  • Where is Eclipse involved in this? Is it doing part of the deployment? – nitind Jun 13 '18 at 05:13
  • cale_b: I was not looking in the correct spot. The target directory is updated, but the tomcat deployment directory (from which everything runs) is not – Thug Jun 14 '18 at 13:26
  • nitind: Eclipse is running the project in Tomcat; it also does the maven builds (including on-the-fly scss compilation) – Thug Jun 14 '18 at 13:26

1 Answers1

0

Solved the problem...

An entry needed to be added to Eclipse’s Web Deployment Assembly so that Eclipse would see this dynamically-generated folder and associate it with the project.

The files were being generated to the local_repo/target/branch_name directory, where branch_name was dynamic, and dependent upon what branch you were working on; this made it impossible to create a static entry in Eclipse WDA for us.

Our solution was to have Maven (1) create a sass-generated/css directory under local_repo/target, and (2) copy the css over into the branch_name/static directory where it belongs.

Now, when debugging locally and running Sass Watch, changes to *.scss files are detected, compiled to css, and deployed to the sass-generated/css directory. Since this dir is associated with the project in Eclipse WDA, Eclipse sees the change and deploys it to Tomcat as expected!

Thug
  • 23
  • 1
  • 6