e107inc / e107

e107 Bootstrap CMS (Content Management System) v2 with PHP, MySQL, HTML5, jQuery and Twitter Bootstrap. Issue Discussion Room: https://gitter.im/e107inc/e107
https://e107.org
GNU General Public License v3.0
320 stars 213 forks source link

exclude bootstrap is not working correctly #4832

Closed Jimmi08 closed 1 year ago

Jimmi08 commented 2 years ago

Bug Description

This settings:

    <libraries>
        <library name="bootstrap" version="5" scope="front"/>
    </libraries>
    <stylesheets>
        <css file="default.css" name="Default"   scope='front' exclude="bootstrap"/>
    </stylesheets>  

is loading CDN bootstrap library

<link rel="stylesheet" media="all" property="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" />

How to Reproduce

Core bootstrap5 theme is working because using word bootstrap in stylesheets.

This works too:

    <stylesheets>
        <css file="bootstrap.min.css" name="Legacy"   scope='front' exclude='bootstrap' />
        <css file="default.css" name="Default"   scope='front' exclude="bootstrap"/>
    </stylesheets>   

This is not working:

    <stylesheets>
        <css file="blue.css" name="Default"   scope='front' exclude="bootstrap"/>
        <css file="red.css" name="Default"   scope='front' exclude="bootstrap"/>
    </stylesheets>  

This works:

    <stylesheets>
        <css file="bootstrap.blue.css" name="Default"   scope='front' exclude="bootstrap"/>
        <css file="bootstrap.red.css" name="Default"   scope='front' exclude="bootstrap"/>
    </stylesheets> 

By the way, with one style in xml, style.css is always set as themecss pref, so this doesn't work either:

    <stylesheets>
        <css file="bootstrap.default.css" name="Default"   scope='front' exclude="bootstrap"/>
    </stylesheets>  

Expected Behavior

Not loading bootstrap css from core

PHP

PHP 8.1

Thanks

Workaround:

    <stylesheets>
        <css file="assets/css/bootstrap.min.css" name="Don't use this"  scope='front' exclude="bootstrap"/>
        <css file="default.css" name="Default 2" default='true'  scope='front' exclude="bootstrap"/>
    </stylesheets>   
Jimmi08 commented 1 year ago

@CaMer0n Is it mandatory to use word "bootstrap" in style name to exclude core bootstrap or this is bug?
This is really important. Thank you.

Jimmi08 commented 1 year ago

This is working solution to not load core bootstrap css on frontend, but still have BOOSTRAP defined. No exclude in stylesheet is needed.

    <libraries>
        <library name="bootstrap"
            version="5"
            scope="wysiwyg" 
            files="css" />
        <library name="bootstrap"
            version="5"
            scope="front" 
            files="js" />
        <library name="fontawesome"
            version="5"
            scope="front"
            files="js" />
        <library name="fontawesome"
            version="5"
            scope="wysiwyg"
            files="css" />
    </libraries>

example for stylesheet:

    <stylesheets>
        <css file="main.css"
            name="Main css compiled with bootstrap"
            default='true'
            scope='front'
             />
        <css file="assets/css/lineicons.min.css"
            name="Default"
            scope='wysiwyg' />
    </stylesheets>