LessCompiler icon indicating copy to clipboard operation
LessCompiler copied to clipboard

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

Open PonchoPowers opened this issue 8 years ago • 4 comments

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 avatar Aug 21 '17 13:08 PonchoPowers

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

PonchoPowers avatar Aug 21 '17 14:08 PonchoPowers

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"

kgjersda avatar Nov 04 '19 09:11 kgjersda

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

PonchoPowers avatar Nov 04 '19 17:11 PonchoPowers

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

mynamespace avatar Nov 06 '19 07:11 mynamespace