question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ASP.NET MVC layout templates are being treated as "partial files"

See original GitHub issue

Original message

In a project that uses layouts in ASP.NET MVC, these files are partial for the framework, but are “normal” CSS files and, to use SASS in these scenario, it should be treated as a normal SCSS file.

Structure:

  • Views
    • Shared
      • _Layout.cshtml
      • _Layout.cshtml.css (to generate this file, the ideal scenario is that a file named _Layout.cshtml.scss could be generated in Live Sass extension)

The reason for this to not work is because files starting with “_” are always treated as partial SCSS files.

There is a chance that if a file is in the pattern of “liveSassCompile.settings.includeItems” it could be processed even if the name starts with “_”? So I could explicit add a pattern (like /**/Views/**/_*.cshtml.scss) to make this work. Or the default “liveSassCompile.settings.excludeList” could contain the pattern /**/_*.*, so this behavior could be configured by the user “out-of-the-box” instead of being hardcoded.

Thanks in advance and congratulations for the great work!


Tasks

  • Apply code changes
  • Update documentation

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
luanmmcommented, Dec 18, 2021

I think that, for my use case, it should work, indeed.

For now, I just need to build some “partial” files (in this specific case, unfortunately, is not the reality, because this is more a conflict in conventions between SASS and ASP.NET that anything else 😄). So, with this new options, it should do the trick.

I think I will help testing it, then, when the new version comes out. 🧑‍🎄

Thanks for the help, @glenn2223. And congratz for the effort to maintain this project!

2reactions
glenn2223commented, Dec 18, 2021

I wasn’t aware of all the behaviors, thanks for sharing your thoughts and expertise. I’m not an expert, so I can’t think of any aspects that I could add/contribute to your suggested design for now.

No problem. It’s also fine if you don’t feel you can contribute to the point. Do you feel this possible solution would work for you?

If somebody could share another point of view, it would be nice to have new contributions and ideas

It’s not happened so far, but here’s hoping for change with some more ideas 🤞. Come on community, weigh in 😂

Otherwise, I could try to follow your guidance and open a PR, if you think that would be helpful

No need for a PR. I just like to share my thoughts and have the chance for feedback, rather than just implementing something that “should do the job”. If I don’t get any further feedback after a few days then I will implement the change myself.

I’m about to have a 2-week break from my uni studies, and a week off from work, so I should have the spare time to pop this in and push an alpha for you/people to try come the new year

Read more comments on GitHub >

github_iconTop Results From Across the Web

ASP.NET MVC 3 - Partial vs Display Template vs Editor ...
EditorFor vs DisplayFor is simple. The semantics of the methods is to generate edit/insert and display/read only views (respectively).
Read more >
Partial views in ASP.NET Core | Microsoft Learn
A partial view is a .cshtml markup file without an @page directive maintained within the Views folder (MVC) or Pages folder (Razor Pages)....
Read more >
ASP.NET MVC 3: Layouts and Sections with Razor
These sections can be defined anywhere in the layout file ... to be stored within a separate partial template (which we'd render using...
Read more >
How to change the default ASP.NET MVC theme - Chris Pratt
I told you a partial view is just a view without a layout, but that's not exactly true. Actually, there's no difference at...
Read more >
Views, Partial Views, and Layouts in ASP.NET Core MVC
If our markup file is large, complex, and composed of several logical pieces, we should split each piece into a partial view. Then...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found