Comments (7)
To be more precise here, this is an example (.less File)
// disables the whole ruleset, just because it's // instead of /**/ h1 { font-size: 20px; /* works, when above // is changed into normal css-comments */ /* // color: #FFFFFF; */ background-color: #000000; /* rule does not work, once the above comment is // only */ }
from less.js.
Sorry, problem solved, since everything else less normally offers also didn't work either with that specific file I got suspicious.
If anybody has had the same problem, make sure you include the .less file as
link rel="stylesheet/less"
since the less-parser actually won't trigger a warning or error of a false less-type include.
I recently renamed a .css into a .less file and also included the less-parser properly, which went through without any errors, so I didn't catch the problem firsthand.
So, here is a feature request:
Since it's really hard to get even find a problem firsthand or get to the problem in this case, is there a way the less-parser can detect a wrongly embedded less-filetype (ie. get link rel content via JS and compare if "stylesheet/less" is correctly placed and triggers a fat warning, since sometimes one just forgets to change this type when including more than one .less file in a document?
from less.js.
@Neohiro79 i guess the problem is resolved please close the issue.
from less.js.
So, there is no thought or comment on my follow-up feature-request to make the less-parser detect a potentially wrongly embedded less-filetype through ie.
var styleSheetList = document.styleSheets;
then comparing the suffix of the filename
if (".less" file && if "text/less") { fine } else { trigger additional warning into console } ?
from less.js.
@Neohiro79 my apologies, missed a couple of lines, thought the issue to be resolved
from less.js.
@Cyddharth-Gupta No problem - I just thought that it would make sense after I discovered that a google search completely mislead me to find/locate this error which took me some hours. It get's "parsed" without an error, in case you include a .less file but with text/css inside the rel attribute.
Also, additional to my proposal there should be also the opposite case covered (ie. ".css" is there but "text/less" is the rel/type value):
if (".css" file-suffix && "text/less") { fine } else { trigger additional warning into console }
and also in case ".less" is there but only "text/css" is written in the rel/type-attribute:
if (".less" file-suffix && "text/css") { trigger additional warning into console } else { fine }
That would cover the basic pitfalls which can always happen when including more than one file (or even in case you just don't know or forgot)
from less.js.
In web requests, a file extension cannot actually tell you what type of file it is, because you can easily set up something like a .php
file that provides the appropriate content and headers for a particular file type. So you need a way to signal, in your markup, what type you expect. Adding a warning in those cases would just possibly add a bunch of noise to the console.
from less.js.
Related Issues (20)
- sys import doesn't work with nodejs 18 HOT 3
- "Selector Interpolation with Extend" possibly contains outdated info (doc states not supported, but works) HOT 5
- Adding a default value to a mixin causes arity match failure HOT 2
- Container style queries unexpected space HOT 8
- Can not find variable when a variable be created in plugin. HOT 2
- Nested @layer rule lost scope HOT 1
- Mixin calls with empty parentheses shouldn't match with classes with the same name
- less variables cannot be used under the not selector, delimiter HOT 1
- 网络安全漏洞修复
- Whether the official statement "Selectors with variables will not match" is wrong? HOT 1
- @font-face doesn't respect scope when compiling HOT 2
- In version 4.2.0, a container query in a mixin that uses a LESS variable doesn't use the right value when the mixin is called multiple times with different values
- `mask-repeat: no-repeat` being transformed into `mask-repeat: initial` in production mode HOT 1
- Empty calculation passed to css in 4.2.0 HOT 4
- less does not compile using vite anymore HOT 1
- Variable interpolation with math operator like + is not compiling properly HOT 1
- Comments with doubleslash are not stripped before compile
- @starting-style doesn't nest correctly HOT 1
- Nested pseudo-selectors that take selectors eport missing a closing ')' when separated by commas
- Lessc to provide preserve comments option
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from less.js.