Ignore content files with specific file extension in specific folder

I know how to ignore content files when rendering:

ignoreFiles = [ "\\.foo$", "\\.boo$" ]

Let’s say there are two types of files in the folder /static/backgrounds/:

  • with file extension .svg
  • with file extension .min.svg

I want to ignore only the .svg (not the .min.svg) files in this specific folder. How can I do this?

As far as I know the ignoreFiles configuration is meant for files under the contentDir not the staticDir.

If I were you I would try placing the SVG files under the assetDir and then fetch the .min.svg ones with the method resources.Get, also -if memory serves me right- it is possible to use pattern matching with the above method.

The manual says

“Assets will only be published (to /public ) if .Permalink or .RelPermalink is used.”

In my case I use the svg files as background images (defined via css). So there is no .Permalink or .RelPermalink…that’s why I think your solution doesn’t work here.

I understand that

ignoreFiles = [ "\\.foo$", "\\.boo$" ]

works only for content files but maybe it would’ve been better to define something like

ignoreContentFiles = [ "\\.foo$", "\\.boo$" ]

for files in content/ and

ignoreStaticFiles = [ "\\.foo$", "\\.boo$" ]

for files in static/. Just an idea for a feature.

You can either use an inline style (heretical but simple)

OR

Have a look at the ExecuteAsTemplate function.

The idea would be to use a small .css file to create the style you need, execute it as a template and then append it to the rest of the stylesheet with resources.Concat

1 Like

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.