Query: I wn complete seperate .css/.scss and .html template file for my webcomponent.js like in angular. But with complete security. In lit. Use any js lib like domPurify, etc. But I wan complete safety. How? ChatGPT said: Thought for 16s Totally doable. Here’s a secure Lit setup with fully separate .html + .scss files , sanitized with DOMPurify , and rendered into the Shadow DOM without sacrificing performance. Folder layout src / lib/ safe- html .js components/ app-shell .html app-shell .scss app-shell .js 1) Install deps npm i dompurify npm i -D sass Vite will compile .scss . We’ll import the compiled CSS as text and attach it via adoptedStyleSheets (fast + memory-friendly). 2) app-shell.html (pure template file) Put your Carbon UI Shell markup here (no scripts). Example stub: < cds-header aria-label = "My App" > < cds-header-name prefix = "IBM" >[Platform] </ cds-header-name > < cds-header-glo...
Assumptions:
1. You are using Linux / Debian Server
2. You are using Compute Engine
3. You are using Google Domains
4. Set $JAVA_HOME=<path to your java base directory>
5. Set $CATALINA_BASE=<path to your Tomcat / Tomee base directory>
-------------------------------------------------------------------------------------
Procedure:
1. Visit site https://certbot.eff.org/
2. In selection option,
a) My website running on <none of the above>
b) Operating system using <as per your operating system>, <Debian 10 in my case>
3. Type command sudo apt-get install certbot
4. Type command sudo certbot certonly --standalone
5. Your certificate will be downloaded and installed in /etc/letsencrypt folder
6. Your certificate files are as follows:
/etc/letsencrypt/live/<your domain name>/cert.pem
/etc/letsencrypt/live/<your domain name>/chain.pem
/etc/letsencrypt/live/<your domain name>/fullchain.pem
/etc/letsencrypt/live/<your domain name>/privkey.pem
7. Change permissions of these file if needed as it have default root access only so that Tomcat/ Tomee user can acces them
8. Type command sudo nano $CATALINA_BASE/conf/server.xml
9. Provide following lines in server.xml
<Connector port="443" protocol="org.apache.coyote.http11.Http11NioProtocol"
maxThreads="150" SSLEnabled="true" >
<UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
<SSLHostConfig>
<Certificate certificateKeyFile="/etc/letsencrypt/live/<your domain name>/privkey.pem"
certificateFile="/etc/letsencrypt/live/<your domain name>/cert.pem"
certificateChainFile="/etc/letsencrypt/live/<your domain name>/chain.pem"
type="RSA" />
</SSLHostConfig>
</Connector>
10. // restart tomc(at/ee) server
11. Check your working https:// website in your domain name
Work Done
Comments
Post a Comment
If you have any doubts, please let me know.