bulrush icon indicating copy to clipboard operation
bulrush copied to clipboard

Add exclude option for css files

Open jay3ss opened this issue 2 years ago • 2 comments

I have a somewhat unusual use case in that I have CSS files that I don't want all CSS files included everywhere in the site which is the current behavior of bulrush. This PR allows the exclusion of CSS files that were added to the EXTRA_PATH_METADATA dict to be ignored if an 'exclude': True key-value pair is added. If that key-value pair isn't added then the theme operates as before.

jay3ss avatar May 27 '23 06:05 jay3ss

I'm not sure I understand the use case - if you want to have a CSS file included in the output but not injected into the HTML, couldn't you just not add it to EXTRA_PATH_METADATA? I.e. for your example:

# Static files
STATIC_PATHS = [
    'extra',
    # ...
]
EXTRA_PATH_METADATA = {
    # ...
}

then content/extra/custom.css just ends up in output/extra/custom.css.

textbook avatar May 28 '23 10:05 textbook

Maybe this has to do with my limited understanding how Pelican works. I had a situation in which I wanted to include a JavaScript app in the output that I had written. That app has CSS files that were meant to be used only on that one page. The only way that I could get the app to be included in the output was to include it in EXTRA_PATH_METADATA (including the CSS files). The styling in those files overrode my site's styling which was undesirable. This was the only way that I could figure out how to include the app and its CSS files without it affecting the rest of the site

jay3ss avatar May 28 '23 20:05 jay3ss