Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

173
Views
Separation of Concerns in Web Components

In every web component tutorial I see people building their custom elements just putting HTML and CSS inside JS (as a string value to an object property). What makes me wonder: Is there a way to make web components without mixing layout, style and behavior like that?

Being more specific, is it possible to build a web component separating the code into three files (.html, .css and .js)? Or even making a single file, but having the code split into three tags (<template>, <style> and <script>)?

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Possible duplicate: How to separate web components to individual files and load them?

Here the author of the accepted answer proposed creating a javascript file that uses fetch() to load the HTML source code for the component. Then inside the HTML file link the separate CSS file using <link rel="stylesheet">

Inside your main HTML file you can then import the script that you create in the first step to load the web component.

This is just a summary, i invite you to check it out by yourself :) Cheers

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!