How to Upload & Make the Modern Library Accept CSS, JS, or Other Custom Files


Hi guys, today we are trying to explore an important concept of all the Modern Libraries. By default, a Modern Library doesn't accept CSS or JS files, but only accepts few templates like pdf, docs, and others which are shown as document types while uploading. If you try to upload these, it generates an error. So how do you solve this? Let's follow the below steps.
Open your SharePoint Online Management Shell.
Run the below scripts:
$cred = [System.Net.CredentialCache]::DefaultCredentials
[System.Net.WebRequest]::DefaultWebProxy.Credentials = $cred
Connect-SPOService -Url $Tenantsite
Set-SPOsite <EnterSiteCollectionurl> -DenyAddAndCustomizePages 0
In the above process, feel free to enter your Authenticated Login Credentials to access your respective Tenant Modern SharePoint site.
Once the above scripts are run, just move to your Modern Library and try uploading any kind of CSS or JS or any other kind of customization files. Now you can make use of the files in developing further Customizations on the Modern SharePoint Environment by using SPFx WebParts or Extensions.
Happy Coding!