Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Will there be multiple css and/or js files included? #125

Open
MichaelBrauner opened this issue Mar 5, 2021 · 3 comments
Open

Will there be multiple css and/or js files included? #125

MichaelBrauner opened this issue Mar 5, 2021 · 3 comments

Comments

@MichaelBrauner
Copy link

MichaelBrauner commented Mar 5, 2021

I think about to use this bundle for my projects.
BUT - I wonder if there will be multiple includes of this css and js files:

 {# CSS. #}
    {% if froala_includeFontAwesome %}
        <link rel="stylesheet" type="text/css" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" />
    {% endif %}
    {% if froala_includeCodeMirror %}
        <link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.3.0/codemirror.min.css" />
    {% endif %}

    {% if froala_includeCSS %}
        <link rel="stylesheet" type="text/css" href="{{ asset( froala_basePath ~ 'css/froala_editor.min.css' ) }}" />
        <link rel="stylesheet" type="text/css" href="{{ asset( froala_basePath ~ 'css/froala_style.min.css' ) }}" />

        {% if froala_arrOption[ "theme" ] is defined %}
            <link rel="stylesheet" type="text/css" href="{{ asset( froala_basePath ~ 'css/themes/' ~ froala_arrOption[ "theme" ] ~ '.min.css' ) }}" />
        {% endif %}

        {% for plugin in froala_arrPluginCSS %}
            <link rel="stylesheet" type="text/css" href="{{ asset( froala_basePath ~ 'css/' ~ plugin ~ '.min.css' ) }}" />
        {% endfor %}

    {% endif %}

    {# Editor textarea. #}
    <textarea {{ block( "widget_attributes" ) }}>{{ value }}</textarea>

    {# JS. #}

    {% if froala_includeCodeMirror %}
        <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.3.0/codemirror.min.js"></script>
        <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.3.0/mode/xml/xml.min.js"></script>
    {% endif %}

    {% if froala_includeJS %}
        <script type="text/javascript"  src="{{ asset( "bundles/kmsfroalaeditor/misc.js" ) }}"></script>
        <script type="text/javascript"  src="{{ asset( froala_basePath ~ 'js/froala_editor.min.js' ) }}"></script>

        <!--[if lt IE 9]>
		<script type="text/javascript" src="{{ asset( froala_basePath ~ 'js/froala_editor_ie8.min.js' ) }}"></script>
		<![endif]-->
        <script type="text/javascript" src="{{ asset( froala_basePath ~ 'js/languages/' ~ froala_arrOption.language ~ '.js' ) }}"></script>

        {% for plugin in froala_arrPluginJS %}
            <script type="text/javascript" src="{{ asset( froala_basePath ~ 'js/' ~ plugin ~ '.min.js' ) }}"></script>
        {% endfor %}
    {% endif %}

    {% if froala_customJS is defined %}
        <script type="text/javascript"  src="{{ asset( customJS ) }}"></script>
    {% endif %}

I mean - this will be included for every form field, when I have multiple on my pages?

Is that right?

@jmsche
Copy link
Contributor

jmsche commented Mar 5, 2021

I think so, that's part of the reason I added Encore build in the docs.

Note CSS/JS files should be downloaded once only though, as the first request returns a 200 status, and the next requests should return a 304 status.

@MichaelBrauner
Copy link
Author

Ok, you mean it will be downloaded only once for sure?

@jmsche
Copy link
Contributor

jmsche commented Mar 5, 2021

If the server is configured correctly, sure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants