Giter Club home page Giter Club logo

dotless's Introduction

Ask questions or join the community using the Gitter

Build status: Build status

NuGet package Version information Description
dotless.Core NuGet Less compiler
dotless.AspNetHandler NuGet ASP.NET Handler to compile less files on the fly
dotless NuGet Backward compatible package (containing Core and ASP.NET Handler). Please upgrade to either dotless.AspNetHandler or to dotless.Core if you don't need ASP.NET stuff
dotless.CLI NuGet Command line interface (console application) to compile less files

.NET Framework version support

Starting with version 1.6 following .NET Framworks are suported:

  • .NET Framework 4.5.1
  • .NET Framework 4.6.1
  • .NET Framework 4.7
  • .NET Standard 2.0 (.NET Core 2.0, Mono 5.4, .NET Framework 4.6.1+)

If your application/library don't run on any of these Frameworks you have to stick with version 1.5.3.

Just Want a .dll?

If you don't care about the source and just want a .dll you can get a compiled release from Github.

Simply select for the latest successful build and click on the "Artifacts" section, here you'll find the latest compiler exe and any dll's required.

Or use the Core NuGet package.

Whats this all about?

This is a project to port the hugely useful Less libary to the .NET world. It give variables, nested rules and operators to CSS.

For more information about the original Less project see http://lesscss.org/. For more information about how to get started with the .NET version see http://www.dotlesscss.org/.

ASP.NET Core Handler

If you want to have a handler for ASP.NET Core applications please check out WebOptimizer.Dotless.

dotless's People

Contributors

antoniodgonzalez avatar benholio avatar chrisjowen avatar cjberg avatar fsw avatar gjunge avatar helephant avatar herrquark avatar ilkerde avatar jamesfoster avatar jamesfoster-excelpoint avatar jongalloway avatar julianbirch avatar julianlettner avatar lukeapage avatar markosindustries avatar milichev avatar mwrock avatar nevett avatar phawxby avatar productiverage avatar rocklan avatar roelrymenants avatar ronl avatar rytmis avatar stoiveyp avatar thecloudlesssky avatar tigraine avatar twenzel avatar wolf-code avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dotless's Issues

Different standards for string->variable concatenation?

I have recently switched from writing mixins for less.js over to writing them for dotless, and I have been noticing a few differences in the way variable/string concatenation works.

If you wouldn't mind observing: https://github.com/dancrew32/lesslib/blob/master/mixins.less#L69-72
I have marked LJS (Less.js style) and the LST (dotLess Standard) way of doing v/s concatenation. Is there a work around for this so that people don't have to write/maintain two separate implementations of the mixin properties that require string->variable concatenation?

If there is only one way to do this in dotLess, do ya think we should probably make note of which method is to be used in the documentation/wiki (and maybe provide several examples)?

dotless.Compiler.Program.Main not *nix-compatible

It seems like that a change introduced somewhere after 1.1.0.3 breaks support for Mono on *nix platforms:

> dotless screen.less
Unhandled Exception: System.IO.DirectoryNotFoundException: Directory '.\' not found.
  at System.IO.Directory.ValidateDirectoryListing (System.String path, System.String searchPattern, System.Boolean& stop) [0x00000] in <filename unknown>:0 
  at System.IO.Directory.GetFileSystemEntries (System.String path, System.String searchPattern, FileAttributes mask, FileAttributes attrs) [0x00000] in <filename unknown>:0 
  at System.IO.Directory.GetFiles (System.String path, System.String searchPattern) [0x00000] in <filename unknown>:0 
  at dotless.Compiler.Program.Main (System.String[] args) [0x00000] in <filename unknown>:0 

Tested in 1.1.0.7a. Since this kind of makes the formula available for homebrew on OSX unusable, I've pulled it for now.

Dotless compiler bug - compiler getting confused

Here's a bit of convoluted less code which causes the bug to arise:

@axefrogstatic: "https://static.axefrog.com/";
@grey8: #f5f5f5;
@grey5: #ccc;
@colorA: #E5225B;
@colorB: #C7C823;

.buttonIcon(@filename) {
    &.fancy {
        @imgbg: formatString("url({0}images/icons/{1})", @axefrogstatic, @filename);
        &:hover {
            background-image: @imgbg, formatString("-webkit-gradient(linear, 0% 0%, 0% 100%, from({0}), to({1}))", @colorA + 30%, @colorA - 20%);
            background-image: @imgbg, formatString("-moz-linear-gradient(0% 100% 90deg,{1}, {0})", @colorA + 30%, @colorA - 20%);
        }
    }
}

.button, button, input[type="submit"] {
    &.lefticon.icon-tick {
        .buttonIcon("fugue/tick.png");
    }
    &.lefticon.icon24-tick.extralarge {
        .buttonIcon("fugue/icons-24/tick.png");
    }
}

And the output is:

.button.lefticon.icon-tick.fancy:hover, button.lefticon.icon-tick.fancy:hover, input[type="submit"].lefticon.icon-tick.fancy:hover {
  background-image: url(https://static.axefrog.com/images/icons/fugue/tick.png), -webkit-gradient(linear, 0% 0%, 0% 100%, from(#ff4079), to(#d10e47));
  background-image: url(https://static.axefrog.com/images/icons/fugue/tick.png), -moz-linear-gradient(0% 100% 90deg,#d10e47, #ff4079);
}
.button.lefticon.icon24-tick.extralarge.fancy:hover, button.lefticon.icon24-tick.extralarge.fancy:hover, input[type="submit"].lefticon.icon24-tick.extralarge.fancy:hover {
  background-image: url(https://static.axefrog.com/images/icons/fugue/tick.png), -webkit-gradient(linear, 0% 0%, 0% 100%, from(#ff4079), to(#d10e47));
  background-image: url(https://static.axefrog.com/images/icons/fugue/tick.png), -moz-linear-gradient(0% 100% 90deg,#d10e47, #ff4079);
}

Notice that the second outputted selector is being generated with the same output as the first text selector, even though it's being passed a different input for .buttonIcon.

Crashed when watching file with subdirectory imports and a file changes

I got this error and it crashed. The file was importing four other less files from a sub directory.

Unhandled Exception: System.Collections.Generic.KeyNotFoundException: The given
key was not present in the dictionary.
at System.ThrowHelper.ThrowKeyNotFoundException()
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at dotless.Compiler.Watcher.FileChangedHandler(Object sender, FileSystemEvent
Args e)
at System.IO.FileSystemWatcher.CompletionStatusChanged(UInt32 errorCode, UInt
32 numBytes, NativeOverlapped* overlappedPointer)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32
errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)

imported relative urls still not working

When a url (like background-image) is in an imported file, any number of "../" are removed from the beginning. This means that no images can be defined in any files outside of the main .less file. This only occurs using the httpHandler. When the file is compiled from the command line, everything works fine.

background-image: url("../images/toolbox_icons/comments.png");

becomes

background-image: url("images/toolbox_icons/comments.png");

Problem with non standard syntax

Hi! I'm getting an error message when trying to use this:

.linear-gradient (@from, @to, @default) {
    background: @default;
    background: -moz-linear-gradient(top, @from 0%, @to 100%);
    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%, @from), color-stop(100%, @to));
    filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='@from', endColorstr='@to',GradientType=0 );
}

I tried using the e() syntax but it didn't work either.

Problem with function overloading

Hi

I'm using dotLess 1.2.1.0 there seems to be a problem with the way overloaded functions are handled. I have a generic function that creates a linear background, using 2 arguments. I have another version that accepts only 1 colour and computes the other colour by darkening the original one. Here's the sample code test.less:

.gradient(@from, @to)
{
    background: @from;
    background: -moz-linear-gradient(@from, @to);
    background: -o-linear-gradient(@from, @to);
    background: -webkit-gradient(linear, 0% 0%, 0% 100%, from(@from), to(@to));
    background: -khtml-gradient(linear, 0% 0%, 0% 100%, from(@from), to(@to));
    background: -ms-linear-gradient(@from, @to);
    background: linear-gradient(@from, @to);
}

.gradient(@colour) {
    .gradient(@colour, darken(@colour, 10%));
}

.TEST {
    .gradient(#aaaaaa);
}

This compiles fine client-side using less.js (http://lesscss.org/). The error given by dotLess is:

.gradient is undefined on line 13 in file 'D:\Downloads\dotless-v1.2.1.0\test.less':
 [12]: .gradient(@colour) {
 [13]:     .gradient(@colour, darken(@colour, 10%));
       ----^
 [14]: }
from line 17:
 [17]:     .gradient(#aaaaaa);[Done]

Handling of CSS hacks

I wrote an email to the list where a positive response was given to the previous idea of using "attributes" to mark CSS hacks

e.g.

[IE7]
.class {
/* will only be applied by IE7 */
}

and

.class {
[IE7] background-color: red; /* will only be applied by IE7 */
}

I've been thinking about this, but I'm really concerned about collision with CSS attributes e.g.

[alt] img{
// all nodes with an alt attribute set containing an image
}

and basically I don't think the notation is extensible.

An alternative for less attributes could be [@ie7] but I'm not sure I like it.

@-moz-document (and universal support for other unsupported attributes)

@-moz-document url-prefix() {
    h1 {
        color: red;
    }
}

dotless totally does not like this selector, which is valid in firefox. To make things easier on yourself, so you don't have to support every obscure vendor definition that comes out, can't you just add a way to escape an attribute name so that it gets parsed "as is"?

Treatment of url to allow all the values allowed in CSS

.cl {
background-position: url(file.aspx?id=images|2.png);
}

/*
missing closing ) for url() on line 2 in file 'C:\lesstest\bug1.less':
[1]: .cl {
[2]: background-position: url(file.aspx?id=images|2.png);
---------------------------------------------^

*/

IIS 404 Errors for .less Files

I've been successfully running *.less in dev using the Cassini server (dev ASP.Net server) but when I publish to my box's local IIS server it's yielding 404 errors. When I attach my debugger to IIS there are no exceptions being thrown.

Any ideas?

Thanks

String Interpolation does not work in Url()

Thanks to James for introducing this feature, which I've started using, however it does not work in Url's.

The fix is to add an Evaluate to the Url node that calls Evaluate on it's value if it is quoted. I have a patch, but I can't submit until some resolution comes to my previous pull request.

relative path in 'imported' less file, not relative to 'inputfile'.

NB. I'm using dotless Compiler 1.1.0.7 on Windows XP.
Please see the folder structure and files below.

Basically, I have a themes folder with a base theme, and any number of actual themes.
In the base theme, I have a .less file with the style sheet rules for all themes.
In each theme, I have a simple .less file which defines certain variables and then imports the base .less file.
Each theme also has their own set of images.

I.e. base\site.less has this rule:
h1 {
background-image: url('../images/logo.gif');
color: @corp-color;
}

and my_theme\site.less looks like this:
@corp-color: #DF7913;
@import "....\base\css\Site.less";

When I compile my_theme\site.less the generated css file is as follows:
h1 {
background-image: url('../../base/images/logo.gif');
color: #df7913;
}

The problem is that the background-image url is relative to the imported base .less file, and not the my_theme.less file (which is the file I'm compiling).

I would have expected the background-image-url to be "../images/logo.gif". Please can advise whether this is a bug, or expected behaviour?

Thanks!
Darragh

Folder structure and files listed below

c:\temp\dotlesstest\themes

c:\temp\dotlesstest\themes\base
c:\temp\dotlesstest\themes\base\css
c:\temp\dotlesstest\themes\base\css\site.less

c:\temp\dotlesstest\themes\my_theme
c:\temp\dotlesstest\themes\my_theme\css
c:\temp\dotlesstest\themes\my_theme\images
c:\temp\dotlesstest\themes\my_theme\css\site.css
c:\temp\dotlesstest\themes\my_theme\css\site.less

Specifying outputfile does not work reliably on *nix

○ dotless -m test.less test-out.css                                                              10:43+0200
[Compile]
/Users/zerok/test.less -> /test-out.css
[FAILED]
Compilation failed: Access to the path "/test-out.css" is denied.
  at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) [0x00000] in <filename unknown>:0 
  at System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
  at System.IO.StreamWriter..ctor (System.String path, Boolean append, System.Text.Encoding encoding, Int32 bufferSize) [0x00000] in <filename unknown>:0 
  at System.IO.StreamWriter..ctor (System.String path, Boolean append, System.Text.Encoding encoding) [0x00000] in <filename unknown>:0 
  at (wrapper remoting-invoke-with-check) System.IO.StreamWriter:.ctor (string,bool,System.Text.Encoding)
  at System.IO.File.WriteAllText (System.String path, System.String contents, System.Text.Encoding encoding) [0x00000] in <filename unknown>:0 
  at System.IO.File.WriteAllText (System.String path, System.String contents) [0x00000] in <filename unknown>:0 
  at dotless.Compiler.Program.CompileImpl (ILessEngine engine, System.String inputFilePath, System.String outputFilePath) [0x00000] in <filename unknown>:0

It seems like if no explicit folder is specified, the current implementation assumes the root directory instead of the current working directory as output folder. If a folder is part of the path, it works:

○ dotless -m test.less ./test-out.css                                                            10:43+0200
[Compile]
/Users/zerok/test.less -> /Users/zerok/test-out.css
[Done]

Tested with 1.2.1.0 on OSX.

more intelligent compression if mixin used after declaration

With the following less....

.m {
background-position: 34px 95px;
}

.clsa {
.m
}

.clsb {
.m
}

the compressed output is...

.m{background-position:34px 95px;}.clsa{background-position:34px 95px;}.clsb{background-position:34px 95px;}

It would be nice if it was

.m, .clsa, .clsb{background-position:34px 95px;}

Inconsistency with Ruby LESS

I've been utilizing a .less file on Windows with DotLess and Mac with Ruby LESS. I've noticed that the following standard CSS:
filter: alpha(opacity=70);

on Ruby LESS needs to be converted to:
filter: ~"alpha(opacity=70)";

this converts properly on Ruby LESS but does not compile on DotLess.

NuGet Package Can use web.config transforms

Hey guys, @turanuk from Microsoft letting you know what you can add the required web.config transformations into your NuGet package so that users get a seamless "working out of the box" experience (and also sections in system.webServer can be added for seamless deployment to IIS or for working against IISExpress). Keep up the awesome work!

Url variables.

This works in the ruby version 1.2.21 ...

[Test]
public void CanHandleStringVariables()
{
var input = @"@buttonsprite : '/Images/button-sprite.png';
a.button,
a.button span,
a.button input {
background: url(@buttonsprite);
}";

var expected = @"a.button, a.button span, a.button input {
background: url('/Images/button-sprite.png');
}
";
AssertLess(input,expected);
}

Override @import "file.css" behavior

Hi,
I am currently switching to dotless from a YUI compression build step, and would love to be able to have @import allow actual importing of the css file rather than leaving the statement as is. When searching for this, I ran into this thread, which mentions allowing the ability to override this behavior: http://groups.google.com/group/dotless/tree/browse_frm/month/2010-06/0bb67ce9340c6b57?rnum=41&_done=%2Fgroup%2Fdotless%2Fbrowse_frm%2Fmonth%2F2010-06%3F

Here is the reason I feel like this is useful: I have a single css file I would like to include in our application, and it is easier to manage / track changes by having different components of it in different files. I could just change the extensions to .less, but the tooling for Visual Studio isn't great (see: http://stackoverflow.com/questions/2346243/open-a-file-in-visual-studios-css-source-editor). It would be the best of both worlds for me to be able to keep them in .css files and have importing work the same as .less imports.

I understand that the existing way is the behavior of less css, so perhaps this could be overriden with a different keyword? How about @importCSS "file.css"; or @!import "file.css";

Thanks, and let me know if there is anything I can do to help!

error if closing } is on unquoted url

.bug { image: url(http://file) }

warns that there is no closing brace.

Please see previous discussion

#49

I think this is quite a nasty bug and should be fixed one way or another, not left because my fix makes the tokenizer aware of url(.

I've been thinking about it alot in the last couple of months and to summarise.

The problem is the tokenizer checks curly brackets and understands comments but not url(.*)

The solution should be to either

  1. remove the checking of curly brackets or
  2. remove support for unquoted url in less
  3. make the tokenizer aware of url().

I favoured the third option because it is less messy - If you are processing url and come across // you have to backtrack and tell the tokenizer it is not actually a comment in this scenario.

If LESS worked how most compilers normally work, I would define a Less grammar which would tokenize - and because of conflicts it would have to be aware of url(matching_URL_regex) as a single entire token. Those tokens would then get processed into an AST ;- I just can't think of a better way of doing it.

However, If anyone can tell me an approach to fix this bug which would be accepted into dotless I'm willing to implement it.

Parsing seems to fail

Hi, thanks for the great dotless port, just started with it and it's truly amazing!

Unfortunately, I came across one small nasty problem: the one-liner below seems to fail on converting, producing an empty .css:

html { font: 62.5%/1.5 Verdana; }

I'm putting the line above into xxx.less file and using the following command for testing: dotless.Compiler.exe xxx

WebResource Handler

make .Less work
with CSS files embedded within assemblies and served using the
WebResource handler?

Support for default variable values

I have a .LESS file in which I would like to define variables with default values. And I would like to optionally overwrite some of the variable values.

@dark_color: #F44B4B;
@light_color: #FFFFFF;
/* rest of the less file */

Now I would like to call the less file with the following arguments
template.less?dark_color=red

I am expecting the following substitution

@dark_color: red;
@light_color: #FFFFFF;
/* rest of the less file */

But url parameters are being ignored .

NullReferenceException with '@media' rules

In versions 1.1.7-15 and 1.2.0, the CSS rule "@media all and (orientation:portrait) " causes a NullReferenceException at src/dotless.Core/Parser/Parsers.cs, line 783. Stepping through the debugger (of the 1.2.0 source) revealed that null was somehow being returned from the MatchString() method, prior to the String.Trim() method executing on the result. Not sure if the line encoding issues previously reported is responsible for this match failing - one would expect the regular expression /[^{]+/ to match " all and (orientation:portrait) " after the @media token.

Anyway, changing line 150 of src/dotless.Core/Parser/Tokenizer.cs to the following fixed this issue for me:
return match == null ? String.Empty : match.Value;

Of the three invocations of this overload of MatchString(), this is the only instance where a method call is invoked directly on the result, so this would theoretically be an issue for the input "@media{...}" (or "@page{...}").

Comments processing error in CSS

Comments in CSS file like (comment is before closing semicolon)

foo {right: -28px/* -10px */;}

causes parsing error, but parsing should be ok.
Thanks.

Classes used as mixins cannot be overridden

There is a bug that has come between 1.1.0.5 and 1.1.0.7. This code no longer compiles (it produces a stack overflow):

.button
{
    background-color: black;
    color: white;
}

.red-skin
{
    .button
    {
        .button;

        background-color: red;
    }
}

Even if the mixin usage of .button; is .button(); it does not work.

Passing variable values with # sign to .Less files throws exception Options

When I pass the variables in to .Less files, and if the values have #
signs, I am getting an object reference exception.

[NullReferenceException: Object reference not set to an instance of an
object.]
dotless.Core.Parser.Tree.Rule.Evaluate(Env env) +85
dotless.Core.Parser.Tree.Ruleset.EvaluateRules(Env env) +172
dotless.Core.Parser.Tree.Ruleset.Evaluate(Env env) +168
dotless.Core.Parser.Tree.Ruleset.ToCSS(Env env) +112
dotless.Core.Parser.Tree.Root.ToCSS(Env env) +71
dotless.Core.LessEngine.TransformToCss(String source, String
fileName) +196
dotless.Core.ParameterDecorator.TransformToCss(String source,
String fileName) +367
dotless.Core.HandlerImpl.Execute() +152
dotless.Core.LessCssHttpHandler.ProcessRequest(HttpContext context)
+90

System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
+100
System.Web.HttpApplication.ExecuteStep(IExecutionStep step,
Boolean& completedSynchronously) +75

dotless.Compilter --watch breaks w/@imports that have relative paths.

with the following folder structure:
-/
-/main.less
-/_some-mixin.less
-/theme/my-theme.less

Both main.less and the my-theme.less @import the _some-mixin.less file via @import "_some-mixin" and @import "../some-import", respectively.

If I dotless.Compiler ./main.less --watch everything works great. It finds the _some-mixin.less file and also watches it, recompiling main.less when I change either main or _some-mixin.

Now do dotless.Compiler ./theme/my-theme.less --watch and it again finds the files and starts watching them. Changing the my-theme.less works and it gets re-compiled. However, changing the _some-mixin.less file fails with:

Unhandled Exception: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.
at System.ThrowHelper.ThrowKeyNotFoundException()
at System.Collections.Generic.Dictionary`2.get_Item(TKey key)
at dotless.Compiler.Watcher.FileChangedHandler(Object sender, FileSystemEventArgs e)
at System.IO.FileSystemWatcher.OnChanged(FileSystemEventArgs e)
at System.IO.FileSystemWatcher.NotifyFileSystemEventArgs(Int32 action, String name)
at System.IO.FileSystemWatcher.CompletionStatusChanged(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* overlappedPointer)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
Signal 79

Are relative imports allowed? I would assume so because compiling the my-theme.less file directly works, its just --watch that barfs.

Compiling a folder of .less files

Is it possible to make the compiler run through a folder (with sub folders) of .less files, and compile out .css files in the respective folders?

when there is a missing closing quote the error message could be more informative

If missing off a closing quote the error message is...

[FAILED]

Compilation failed: Missing closing quote (')
at dotless.Core.Parser.Tokenizer.SetupInput(String input)
at dotless.Core.Parser.Parser.Parse(String input, String fileName)
at dotless.Core.LessEngine.TransformToCss(String source, String fileName)
at dotless.Core.ParameterDecorator.TransformToCss(String source, String fileName)
at dotless.Compiler.Program.CompileImpl(ILessEngine engine, String inputFilePath, String outputFilePath)
[Compile]

It would be nice if it could give the line number of the opening quote...

Escaping

Hi.

First of all, thanks for porting less over to dotnet...

I'm having problems with one of the microsoft proprietary filters (opacity) in the less code.
The lesscss.org site states these should be escaped with e("filterHere")... but this doesn't seem to work?

The code I have is:
filter:e("alpha(opacity=@op)");

@op is the value being fed into the mixin, and will need to be evaluated before ouput.

Is this something that can be added? is it already added, and I'm just doing it wrong?

Cheers

Parse error when variable and !IMPORTANT on the same line

The initial title of this issue was "border-bottom-color is not considered a valid CSS property", but after making some more tests I think the error is caused by having a variable and "!IMPORTANT" on the same line.

I have the following in a .less file:

border-bottom-color: @white !IMPORTANT;

And get the following error when trying to compile it using dotless-v1.1.0.7a:

Expected '}' on line 85 in file 'Z:\Projects\Layout.less.css':
 [84]:     border-color: inherit;
 [85]:     border-bottom-color: @white !IMPORTANT;
       ----^

If I remove the !IMPORTANT or replace the variable with a fixed color value it compiles fine. I'm trying .less because less.js was not producing the results I wanted, it turns out this is the reason why; it affects both projects.

@page null reference error

I am using html 5 boilerplate. The @page in the @media directive is throwing an exception. I cut down the css to what throws.

@media print {
@page { margin: 0.5cm; }
}

[NullReferenceException: Object reference not set to an instance of an object.]
dotless.Core.Parser.Parsers.Directive(Parser parser) +352
dotless.Core.Parser.Parsers.Primary(Parser parser) +361
dotless.Core.Parser.Parsers.Block(Parser parser) +126
dotless.Core.Parser.Parsers.Directive(Parser parser) +384
dotless.Core.Parser.Parsers.Primary(Parser parser) +361
dotless.Core.Parser.Parser.Parse(String input, String fileName) +283
dotless.Core.LessEngine.TransformToCss(String source, String fileName) +108
dotless.Core.CacheDecorator.TransformToCss(String source, String fileName) +206
dotless.Core.ParameterDecorator.TransformToCss(String source, String fileName) +365
dotless.Core.HandlerImpl.Execute() +149
dotless.Core.LessCssHttpHandler.ProcessRequest(HttpContext context) +90
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +181
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +75

Improve minification

A currently absent optimization is to simply replace all instances of
;}
with
}

This is because the last rule in a selector does not require a trailing semicolon.

Hopefully this is a quick fix ;)

Font-size rounding limited to 2dp

If I declare a variable with more than 2 decimal places, it is rounded on compile to 2dp.

eg. @font_14: 0.875em; is output as 0.88em;

This results in the computed font size being slightly off what I would expect - in the above example it becomes 14.0833px instead of 14px.

Quote in less-style comments

If you use the less-style (versus css style) comments, there is a parsing error if there is uneven number of quotes:

//this is dan's class
.dans-class
{
    background-color: black;
}

This produces a compilation error.

How to eliminate VS errors?

Getting some noisy messages when making less files in visual studio (as both .less and .less.css)
http://gyazo.com/8edbf4226d1f22e58cc0eae600504342.png

The messages are:

Info - Could not find schema information for the element 'dotless'.
Info - Could not find schema information for the attribute 'minifyCss'.
Info - Could not find schema information for the attribute 'cache'.
Warning - Unrecognized '@' block type.
Warning - Validation (CSS 2.1): '@foobar' is not a valid value for the 'background-color' property.

just for running the following code
@foobar: #eee; body { background-color:@foobar; }

Is there any way to get rid of these types of warnings/info messages?

Twitter Bootstrap and dotless

I had some trouble trying to use twitter's less framework https://github.com/twitter/bootstrap with dotless (nuget version through squishit).

I think it is because of some undefined functions built into some implementations of less. The functions are lighten, darken, spin and maybe a few others. Is there support (or planned support) for these in dotless?

Comments between css selectors break parser

/* comment /
.clsa,
/
comment */
.clsb {
background-position: 34px 95px;
}

/*
Parse Error on line 2 in file 'C:\lesstest\bug2.less':
[1]: /* comment */

   -----^

[3]: /* comment */[Done]
*/

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.