Developer forum

Forum » Feature requests » Add possibility to control what js and css files are included in front end

Add possibility to control what js and css files are included in front end

Morten Bengtson
Reply

Some standard modules always include CSS and JS files and there is no way to prevent this.

 

  1. We don't want your CSS and JS in front end.
  2. We need full control over what is rendered in front end.
  3. Your CSS and JS is invalid and not minfied.
  4. Your CSS and JS results in more HTTP requests, which is bad for performance.

As an example the Forum module always includes /Files/Templates/BasicForum/Styles.css even if "Ignore all module js and css when using designs and layouts" is activated in Management Center.

 

I reported this as a bug, but got a reply from Lars Britz where he refers to the manual where it says:

"Enable this option to ignore module code that is unnecessary when using designs and layouts".

According to Lars, the Styles.css included by Forum is not "unnecessary".

How can any CSS file be necessary?! Please explain.

 

Anyway...

It would be great if we were able to prevent all standard modules from including CSS/JS in front end - but still be able to include our own files using the CSS/JS file selectors on the paragraph module tab.

 

/Morten 


Replies

 
Nicolai Høeg Pedersen
Reply

Hi Morten

 

You are totally right!

 

That setting seems to be badly implemented since it only affects some files in the news module.

So, I'll add a new checkbox after the above, "Yes, all - I decide" which will remove ALL included CSS files.

 

BR Nicolai.

 
Morten Bengtson
Reply

What about JS files? We don't want them either :)

And can we still include our own files by using the "Stylesheet" and "Javascript" settings on the paragraph module tab, which is actually useful?

 
Imar Spaanjaars Dynamicweb Employee
Imar Spaanjaars
Reply

And what about files added to the PageView using the API with custom code? Can you distinguish between user files and DW files?

Imar

 

 
Morten Bengtson
Reply

And will front end edit still work?

 
Nicolai Høeg Pedersen
Reply

Oh, all those wishes.

 

I'll just do some AI for tomorrow, and we are home free :-).

 

I'll have to look into it - I will probably be able to do something that will take most scenarioes into consideration.

 

BR Nicolai

 
Per Jensen
Reply

And make it so we can remove the "base href" also.

 

We would love full control over frontend :)

 
Nicolai Høeg Pedersen
Reply

I've looked into this.

 

@Per - disable base href. I've made the option for 8.2.3 - even though I still dont understand :-)

 

@Morten. I've checked this include things. And it seems like it is the news, forum, newsletterv3, maps and employee modules that include scripts and css. Have you seen other includes?

 

BR Nicolai

 
Morten Bengtson
Reply

Hi Nicolai,

I can't think of any other modules that outputs scripts and styles, besides some old legacy modules and IPaper. I will let you know if anything "unnecessary" shows up ;-)

 

 
Nicolai Høeg Pedersen
Reply

@Per - your request will be out in 8.2.3, TFS #11684

 

@Morten - the only change made is the include of the /Files/Templates/BasicForum/Styles.css file. The other modules are either deprecated or will break totally if the css/scripts are removed. With regards to the forum, it still include css and js needed to render the editor. will be out in 8.2.3, TFS #11685

 

BR Nicolai