html/css generation link issue - parceljs

I have an issue with parcel.
I have a first html file in src folder (index.html) that reference an other html: help.html (in a <a> tag).
This file is in src/gen because it is generated from markdown.
src
|- index.html
|- gen
| | help.html
|- help.css
This help.html reference a css in src folder: help.css, so with
<link rel="stylesheet" href="../help.css">`
It works fine in debug with parcel serve.
But with parcel build, it generate the help.html in a gen folder (I am OK with that), but move the css in this folder (why not)
build
|- index.html
|- gen
| |- help.html
| |- help.b3bef967.css
but in the html, it is a wrong path, relatively to the file:
<link rel="stylesheet" href="gen/help.b3bef967.css">
and my target configuration in package.json is:
"source": "src/index.html",
"distDir": "./output",
"publicUrl": "./"
Where I am wrong ?

Related

vscode omnisharp not working for solution but works for project

I have folders structured like this: project/csproj A, project/csproj B
If I open in vs code project dir, omnisharp works for csproj B only. If I open in vs code project/csproj A directory, omnisharp works for this project.
How fix that so I can open project directory and have working omnisharp for both projects?
Broken project is nunit type if that matters. I tried reloading vscode, disabling/enabling omnisharp.
I created project in empty directory with
dotnet new nunit -n=projectB
A solution is specified by a sln file, if you don't have one yet, just create a new one in the solution-level folder
dotnet new sln
And then, you must add the project references to the solution
dotnet sln path/to/solution add path/to/project
And if the omnisharp does not update it, restart it or vs code.
Omnisharp can only support a single project or solution, therefore, to support multiple projects, you must use "solution", which is not just a folder but with a sln file.
Your folder structure is antipattern and not naturally supported, because .NET Core uses SDK-style csproj project, which adds all source files in the project-level folder (which is where the csproj file is), so having multiple csproj files inside one project-level folder is just for one project with multiple targetings. If your project A and B is in the same folder, it means they may contain duplicate source files that may cause errors on conflict of types, unless you specified source exclusion respectively in the csproj files.
The recommanded folder structure is
<Solution and git repository level folder>
|-- src
| |-- <Project level folders>
| | |-- <Folder structures based on namespace>
| | | └-- <Source files>
| | |-- <Asset files with approprate folder structure>
| | └-- <The csproj file>
| |-- Directory.Build.props (Common MSBuild props for all src projects)
| └-- Directory.Build.targets (Common MSBuild targets for all src projects)
|-- test
|-- └-- <Test projects with similar folder structure to src>
|-- build
|-- └-- <Common MSBuild props and targets files to be referenced by src and test>
|-- docs
| └-- <Documents>
|-- <Other repository assets>
└-- <The sln file>

Can I specify the output folder for assets?

I have a project with this structure:
src
|- index.pug
| - layout
| |- index.less
| - scripts
| |- index.js
For now, when I run parcel build src/index.pug, all the files are bundled and I've got this on the distribution folder:
dist
|- index.html
|- index.12345.css
|- index.12345.js
When I was spected something like:
dist
|- index.html
|- layout
| |- index.12345.css
|- scripts
| |- index.12345.js
So, my question is: Can I specify the output path for my css, js and images using ParcelJS?
Parcel doesn't support this feature out of the box, but I've developed a plugin for it. Check it out https://www.npmjs.com/package/parcel-plugin-custom-dist-structure
It is suitable for all types of web/node development projects, it will generate the dist structure you specify while also handle your imports.
Let me know what you think!
With version 1 it's not supported. This is supposed to be available in version 2 through user plugins. See https://github.com/parcel-bundler/parcel/issues/233

sump up of setting up amp-jekyll in my project

I am working on a jekyll project and already asked some questions on stackoverflow and jekyll talks site. This post is a sump up for the issue I have about setting up amp-jekyll. amp-Jekyll is a jekyll plugin. The full documentation is at this adress : https://github.com/juusaw/amp-jekyll
The tree of my project is the following
My Version of jekyll is jekyll-3.6.2
I installed the plugin using the Gemfile (gem "amp-jekyll", "1.0.2" # installed). I checked that the plugin is well installed.
Then I followed the documentation:
1) I Placed the layout file (amp.html at https://github.com/juusaw/amp-jekyll/blob/master/amp.html) to the _layouts folder. I have a first question about that. I looked at this file and don't know how to use it. Have I just to copy it in the _layouts folder and that's all or have I to take a part of it and copy it to another file (and if so where ?). I can see in the body part the use of {{ header | amp_images }} or {{ footer | amp_images: false, 24, 24 }}. What does that mean ? . And what about the part included in head tag ?
2) Then, I Added amphtml-link to post heads (Add CSS styles to the html template). In my case I just copy the following code
{% if page.path contains '_posts' %}
<link rel="amphtml" href="https://localhost::4000/inger/toto.html">
{% endif %}
with a faked href url in my footer.html file (https://github.com/flamant/fileshare/blob/master/footer.html).. I have a second question about this snippet of code. What is this link ? and is it taken into consideration if this page a post ?
3) And I run bundle exec jekyll serve
The first page witch is published is index.html. the code is
---
layout: default
title: Hank Quinlan, Horrible Cop
lang: fr
---
<div class="blurb">
<h1>This is content</h1>
</div>
The default.html file (in _layouts folder) is the following
<!DOCTYPE html>
{% include header.html %}
{{ content }}
{% include footer.html %}
And the header.html is at the following location : https://github.com/flamant/fileshare/blob/master/header.html
The first images that I display (and that I can't see) are in this file.
So my main question is : Why I can't see the images ?
finally I found what was going wrong : the attribute should be src instead of scr. I am confused about asking this question.

bootstrap_3_layout.html.twig in Symfony3

How can I install "bootstrap_3_layout.html.twig,... for my project on 3 version Symfony?
When I copy these files to my project I get error:
'Unexpected character "&"' (Twig_Error_Syntax).
Don't copy or past these files, but instead configure the TwigBundle to use them as form templates, make this configuration in your config.yml file
twig:
form_themes:
- bootstrap_3_layout.html.twig
Make sure that bootstrap is used in your application
Use this
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
Or download it and use it in your application

Nuget files being packed into the wrong places

I have a nuget spec file with the file spec:
<files>
<file src="content\App_Start\*" target="content\App_Start" />
<file src="content\Views\*" target="content\Views" />
<file src="content\web.config.transform" target="content" />
<file src="readme.txt" target="" />
</files>
This used to be:
<files>
<file src="content\*" target="content" />
<file src="readme.txt" target="" />
</files>
but that had odd behaviour as well (spefically the App_Start wasn't being included, though the extra content folder was still being added for the views ... see description below)
The project itself is arranged in the format
\<root>
|_ readme.txt
|_ content
|_ Views
| |_ Home
| |_ <viewname>.cshtml
| |_ <viewname2>.cshtml
|_ App_Start
|_ <PreprocessFilename>.cs.pp
What appears to be odd behavior to me however is that NuGet pack is producing a zip file with the structure:
\<root>
|_ readme.txt
|_ content
|_ content
| |_ Views
| |_ Home
| |_ <viewname>.cshtml
| |_ <viewname2>.cshtml
|_ App_Start
| |_ <PreprocessFilename>.cs.pp
|_ readme.txt
So with respect to nuget packaging file paths:
Why is readme.txt being duplicated in two places?
Why are the views being given a second 'content' sub folder? (while App_Start isn't)
How can I make the copy of my content folder reflect precisely what the actual structure is?
How can I return to the <file src="content\*" target="content" /> directive to make the nuspec file more "maintainable"
If it is relevant, I am using a .csproj file to create the package.
I am having the same issue, i was able to work around it but kinda a hack IMO. I would love to see a better solution so that my project can have the dir tree I intend in the final package but I needed this to work today so.......
what i had to do to get around this was pull all sub dir in the content dir out and place at the root level then in the set the target to the sub dir i wanted it to end up in.
<file src="Scripts\" target="content\Scripts" />
The behavior seems to be that when you pack a .csproject nuget pack MyProject.csproj, it will first arrange the package accordingly to your project structure and then look at the nuspec for additional instructions. But there doesn't seem to be any way to have your nuspec remove content added in the previous step when you pack by the project.
Thus, if the default project structure leads to unwanted content in your package, you should rely on packing directly by the .nuspec instead. nuget pack MyProject.nuspec Then it will only fetch the content that is specified in your nuspec, in which you can define the content exactly how you want it.
If you have a big project that almost have the structure you want, it could be convenient to first build the package from the project, use Nuget Package Explorer to extract a nuspec from this package that you later adjust to fit your need and that you finally pack against. That way you don't have to build it from scratch.
Edit
Or... You could execute the packing with the -Exclude parameter on a .csproj where you tell it to ignore some specific files and write a custom specification for these files in the .nuspec that will be read automatically for additional data.
I personally find it to be more concise to have the .nuspec as your sole definition for your package though.