Coder Social home page Coder Social logo

lessmsbuildtasks's Introduction

LessMsbuildTasks

A targets file and MsBuild tasks, that will enable compiling of .Less files

The easiest way to get it up and running is through installing it through NuGet

 Install-Package LessMsbuildTasks

The Nuget package will create a new folder in the solution directory called .less. This folder will contain a .targets file as well as some dll's that are required for the .targets to work.

It will also automatically import that .targets file into your project file.

Once the targets file is imported you will get a new Build Action "DotLess". This build action is selectable from the properties drop down. Any files you set to use this build action will be compiled with the .less compiler.

In addition, the compiler is smart and will only attempt to compile the file again if it or any of the files it imports have changed since the last time it was run.

Advanced Options

There are a few Msbuild properties that you can change in order to affect the functionality of the compile

LessOutputDirectory: (string) The base directory where the .css files will be output to (defaults to $(WebProjectOutputDir)) which is normally the project root but if being run from Tfs it is the the _PublishedWebsites directory.

LessKeepRelativeDirectory: (boolean) By default it will append the relative path from the project root to the Output directory path, set this to false if you want to override that behaivor.

LessMinifyOutput: (boolean) Output CSS will be compressed. (defaults to True for release builds and False for debug builds)

LessDebugMode (boolean) Print helpful debug comments in output.

LessDisableUrlRewriting (boolean) Disables changing urls in imported files

LessImportAllFilesAsLess (boolean) Treats every import as less even if ending in .css

LessInlineCssFiles (boolean) Inlines CSS file imports into the output

LessDisableVariableRedefines (boolean) Makes variables behave more like less.js, so the last variable definition is used

LessKeepFirstSpecialComment (boolean) Keeps the first comment begninning /** when minified

LessForceRun (boolean) If this is true, it will always run and not check to see if anything has changed

LessCreateSourceMap (boolean) Creates source maps for generated CSS files (filename.css.map)

lessmsbuildtasks's People

Contributors

arryalove avatar edguest avatar fuzzybearbtc avatar rychu-pawel avatar uweg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

lessmsbuildtasks's Issues

LessDisableUrlRewriting is not implemented (Update)

I downloaded the lastest Nuget Package (LessMsbuildTasks.1.0.8) for this and there seems to be an issue with the package. The 2 errors below show up when I reference it in my project.

Error 1 The "LessDisableUrlRewriting" parameter is not supported by the "NodelessCompile" task. Verify the parameter exists on the task, and it is a settable public instance property.
Error 2 The "NodelessCompile" task could not be initialized with its input parameters

I decompiled the LessMsbuildTasks.dll that it is included in the project and there is no public instance property on called LessDisableUrlRewriting on the NodelessCompile class.

Does not seem to work with VS 2013 / WinJS app

I'm trying to use this with a WinJS application for Windows 8.1 in Visual Studio 2013.

The only thing that changes when I load the nuget package is that the LessMsbuildTasks.txt file is added to the project. No new tags or anything and no new build actions are there either.

ENOENT error when compiling from path containing a space

We've got a C# project where the .less compilation isn't working for one of our developers (set as a build action on the .less file and working for other developers using the same project).

From what I can tell the problem is that his Windows username contains a space, so his checked out less file is at C:\Users\First Last\Documents\GitHub\Project\Project\Website\Content\less\project.less

The output he gets when building includes:
lessc: ENOENT, open 'C:\Users\First Last\Documents\GitHub\Project\Project\Website\Content\less\Last\Documents\GitHub\Project\Project\Website\Content\css\project.css.map'

My initial thought is that the "build from" parameter is not being quoted / escaped properly before being passed to the build script, but I'm not sure where that happens.

The "NodelessCompile" task was not given a value for the required parameter "OutputFolder".

c:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild hcp.Web\hcp.Web.csproj /p:Configuration=%_configuration% /p:Platform="AnyCPU" /P:DeployOnBuild=true;DeployTarget=Package;_PackageTempDir=..%_mainDeployDir%%_configuration%

C:\dev\hcp\packages\LessMsbuildTasks.1.0.6\tools\LessCompiler.targets(40,5): error MSB4044: The "NodelessCompile" task was not given a value for the required parameter "OutputFolder". [C:\dev\hcp\hcp.Web\hcp.Web.csproj]

Where do I specify the MSBuild Properties

I want to set a custom output for my compiled CSS files using the LessOutputDirectory property. Where do I set that property? Is there a file I need to add to my project?

LessDisableUrlRewriting is not implemented

Hello,
I just found out that the LessDisableUrlRewriting switch is not implemented. It can be found only in the docu, but it is not parsed in LessCompiler.targets, neither in the NodelessCompile.cs. Seems like someone didn't checked also the implementation of this.

Is there any plan to support further this project?

Kind regards,
Radu

LessDisableUrlRewriting option not implemented

The ReadMe lists this as an advanced option, but it doesn't appear to be implemented There's no conditional around the corresponding argument - it's always included:

//Add this option to make urls relative.
args.Add( "--relative-urls" );

We need the ability to disable this - can you add the option (or add it back)? Thanks!

VS 2019 build error caused by space in condition (LessMsbuildTasks.targets)

There is an unwanted space before closing bracket in LessMsbuildTasks.targets LINE 22:
$(LessDisableUrlRewriting ) == ''"
which prevents loading of web application projects in VS2019 ( error : Unexpected space at position "25" of condition "$(LessDisableUrlRewriting ) == ''". Did you forget to remove a space?)

Compile less files target doesn't run on a teamcity clean build

We have a MVC application and less files compilation in teamcity using msbuild doesn't work when a clean build is done. The following build without clean works fine.

I have compared the logs of the msbuild with and without clean.
On clean, the 'CompileLessFiles' target doesn't run after target '_CopyWebApplication' whereas on the other build it does.

I do not understand why this happens and if there is a way to get this to work

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.