madskristensen / LessCompiler

A Visual Studio extension
Other
15 stars 8 forks source link

When saving transpiled CSS to a different directory using comments to set the transpiler directives, Visual Studio 2017 shows strange folders #3

Open PonchoPowers opened 7 years ago

PonchoPowers commented 7 years ago

When saving transpiled CSS to a different directory using comments to set the transpiler directives, Visual Studio 2017 shows strange folders.

less directory compile issue

Comment // lessc "../../../content/themes/ipswich/css/site.css"

PonchoPowers commented 7 years ago

These are the errors I get:

Severity Code Description Project File Line Suppression State Warning The file 'Themes\Ipswich\Less......\content\themes\ipswich\css\site.css' could not be added to the project. The specified path contains invalid characters, is an absolute path, or is a path outside of the project directory. Wiki
Warning The file 'Themes\Ipswich\Less......\content\themes\ipswich\css\site.css' could not be added to the project. The specified path contains invalid characters, is an absolute path, or is a path outside of the project directory. Wiki
Warning The parent file, 'site.css', for file 'Themes\Ipswich\Less......\content\themes\ipswich\css\site.min.css' cannot be found in the project file. Wiki
Warning The file 'Themes\Ipswich\Less......\content\themes\ipswich\css\site.min.css' could not be added to the project. The specified path contains invalid characters, is an absolute path, or is a path outside of the project directory. Wiki
Warning The file 'Themes\Ipswich\Less......\content\themes\ipswich\css\site.min.css' could not be added to the project. The specified path contains invalid characters, is an absolute path, or is a path outside of the project directory. Wiki
Warning The file 'Themes\Ipswich\Less......\content\themes\ipswich\css\site.min.css' could not be added to the project. The specified path contains invalid characters, is an absolute path, or is a path outside of the project directory. Wiki
Warning The file 'Themes\Ipswich\Less......\content\themes\ipswich\css\site.css' could not be added to the project. The specified path contains invalid characters, is an absolute path, or is a path outside of the project directory. Wiki
Warning The parent file, 'site.css', for file 'Themes\Ipswich\Less......\content\themes\ipswich\css\site.min.css' cannot be found in the project file. Wiki
Warning The parent file, 'site.css', for file 'Themes\Ipswich\Less......\content\themes\ipswich\css\site.min.css' cannot be found in the project file. Wiki

kgjersda commented 4 years ago

I also did this, then I tried to delete the folder from Visual Studio. Which led to a less than ideal situation where most of my project files were deleted, leading me to lose a couple of hours work.

image

image

The problem is *.csproj in visual studio is updated with new paths:

+    <Content Include="LESS\..\css\app.css" />
+    <Content Include="LESS\..\css\app.min.css">
+      <DependentUpon>app.css</DependentUpon>
+    </Content>

My solution was not to use relative paths // lessc "../css/app.css"

Use absolute path // lessc "/css/app.css"

PonchoPowers commented 4 years ago

@kgjersda I gave up with it in the end and started using gulp instead.

mynamespace commented 4 years ago

@Matthew-Bonner I tried to use an absolute path, too: the generated file was inside c:\css\styles.css.