In answer for this topic is shown how to pass variable to LESS file with BundleTransformer for LESS and LessTranslator. Unfortunelly in SASS kind of BundleTransformer isn't available property GlobalVariables. Is possible to compile SASS file with custom variable (value of color) depends on login user?
SASS with custom value of variable in ASP.NET MVC
1.7k Views Asked by cadi2108 At
2
There are 2 best solutions below
0
Andrey Taritsyn
On
Solution of a similar problem (only for LESS) described in the “BundleTransformer.Less inject variables depending on context/request” discussion. I.e. you also have to write your own implementation of caching system and use InjectContentItemTransform class (to declare variables need to use Sass-syntax). But unlike LESS, you do not have the ability to modify variables (available only ability to declare variables).
Related Questions in ASP.NET-MVC
- I have a problem outputing the roles on the page ListRoles.cshtml
- Dropdown list showing SQLServer2005SQLBrowserUser$DONSERVER instead of Active Directory group name in ASP.NET MVC C#
- Hosting ASP.NET MVC application on IIS web server using Windows 2019 server
- How to display only department fields associated with a selected department in student automation system?
- How to send select input data for form submission?
- Multi level project reference using dll
- How to upload file to Onedrive using ASP.NET MVC?
- ASP.NET MVC web app looping between fields only on some devices
- Is there any automatic job to load AD-groups?
- How to restrict admin js files to download
- Download PDF in ASP.NET MVC application
- How to add bootstrap theme/example into ASP.NET MVC 5?
- Web API works with Windows authentication enabled when consumed via Swagger but throws an unauthorized issue when accessed through web app
- ASP.Net Core 7.0 Web App (Model-View-Controller) ErrorViewModel OnGet OnPost do not get called or executed
- OAuth 2.0 keep getting Authorization has been denied for this request
Related Questions in SASS
- Swiper pagination bullet: styling for visited slides' pagination bullet as well
- Vue TransitionGroup not working properly because of css transition
- Angular version 17, is it possible and how to connect several preprocessors (LESS, SASS, SCSS, etc.)
- Angular 17 | Angular Material 17.3.1 Issue with styling Angular Material Menu component
- How does CSS properties from figma files in 1920X1080 screen resolution work on different laptop screen resolution?
- Not able to set font-size: 12px in ant-design components & also not able to apply a custom google fonts to ant-design components
- How Can i rid of the red lines while declaring variables in .scss file in VS code
- How to add wallpaper with CSS on a Hugo theme?
- not able to target element
- How to Fill Empty Space in CSS Grid?
- Is there a way to fix the list to become horizontal and teh banner to become orange
- Mask a sticker image so that it fits onto a main image without parts of the sticker that are outside the image being visible - How?
- problem with @use in scss file Yii2 advanced
- How to create a button with a svg inside correctly?
- Angular Material variables in scss
Related Questions in BUNDLETRANSFORMER
- Disabling JS/CSS bundling if debug=true in Web.config
- MVC4: After bundling the JS is not working properly but without bundling the functionality is working fine
- BundleTransformer: Bootstrap SASS
- Create ThemeBuilder for dynamic themes
- DotNet - MVC: Testing for validating css minification
- BundleTransformer.AutoPrefixer Not Prefixing
- BundleTransformer CSS/JS Minify not working
- BundleTransformer.Less isn't processing .less files if variables are out of order
- BundleTransformer LibSass Could not be found error
- How to configure UglifyJS 2 to only concatenate in C#?
- Bundle Transformer in ASP.NET Web Application (NOT MVC)
- How to generate sourcemaps in Bundle Transformer's Less compiler?
- BundleTransformer for less complaining "Could not find a factory, that creates an instance of the JavaScript engine"
- How to debug exception from bootstrap grid.less and ClearScriptV8
- Are there any BundleTransformer JS minifiers that support ES6?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
I've not used the SASS extension so I can't say for certain, but you could always create a custom bundle transform to replace what is essentially a 'template' file.
So you could have a SASS file with variables declared like so
Then use something similar to the following to replace the values.
To use it add the transform to the bundle.
We've used something similar for a Script Transform to inject bundle urls into script files at runtime to get the full URL generated by the Optimization framework. This admittedly might not work for you if the transforms are executed after the SASS translation happens but, I've not had the time to spin up a SASS project to test this.
I hope this helps.