Current Process:


I am having a CSS & JS file in Site Assets, which I render it to some List / Library using Content Editor ( referencing the CSS/JS).

Requirement


What I need is, End User shouldn't access these files or see the codes inside my CSS & JS. Is there any possibility that I will add the CSS/JS inside a Master Page or somewhere else (globally) and get the List and Library name (to be applied with changes) from a master list !! So that a non-coder admin can only add list/lib name into that master list and the required changes will apply on that list/library automatically

  • 1
    just curious to know, "What I need is, End User shouldn't access these files or see the codes inside my CSS & JS" user should have at least read permission to those files then only css or JS will be applied or loaded to the page. There is nothing wrong if user sees your Javascript code since he/she cant modfiy. if you want your script to be non readable format. you can try to minimize the script and store in site Assets. – vinit kumar Dec 7 at 9:28
  • Thanks for the comments @vinitkumar, how can I minimize a script or stylesheet, please suggest. – Tezz Chaudhary Dec 7 at 9:56
  • 1
    You can easily find many tools or onsite website available which does minification of javascript. Some tools even bundle your js so user can't easily understand code. Developer like us still can understand😊. Here a website javascript-minifier.com – vinit kumar Dec 7 at 15:16

You can:
1. Break CSS / JS files role inheritance in your document library and give it more advanced permissions for End User. And he can see this files.
2. Embed your css and js into page. Content Editor or Script Editor allow this.
3. Create your own document library only with that files and give End User access to this new document library.

Master page here is must be last way.

New contributor
Vsevolod Vasilev is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.