How do you use Bootstrap with Lit-Element?How can I get my Twitter Bootstrap buttons to right align?Change navbar color in Twitter BootstrapWhat is the difference among col-lg-*, col-md-* and col-sm-* in Bootstrap?How to import popper.js?Bootstrap 4 tab.js active states stuckPurpose of the “$=” or “?=” in lit-element examplesHow do I consume a polymer lit-element?Bootstrap popper.js Failed to find a valid digest in the 'integrity' attribute for resourceLit-Element: which event to use for DOM updates?How to test Web Component (lit-element) with jest
The 100 soldier problem
I feel like most of my characters are the same, what can I do?
Linear independence of element-wise powers of positive vectors
How can I get a language selector in top bar in Ubuntu 19.04?
How is the problem, G has no triangle in Logspace?
I was cheated into a job and want to leave ASAP, what do I tell my interviewers?
Is there any actual security benefit to restricting foreign IPs?
I reverse the source code, you negate the input!
Reaction of aqueous sodium carbonate with aluminum foil
Microservices and Stored Procedures
Do household ovens ventilate heat to the outdoors?
Safely hang a mirror that does not have hooks
Simulate a 1D Game-of-Life-ish Model
Nanomachines exist that enable Axolotl-levels of regeneration - So how can crippling injuries exist as well?
Do things made of adamantine rust?
What's the purpose of autocorrelation?
Create a magic square of 4-digit numbers
What are the end bytes of *.docx file format
Is it really necessary to have 4 hours meeting in Sprint planning?
Debussy as term for bathroom?
Manager manipulates my leaves, what's in it for him?
Can Northern Ireland's border issue be solved by repartition?
Can multiple wall timers turn lights on or off when required?
Would a flying character fall prone after dashing if they had lost a leg?
How do you use Bootstrap with Lit-Element?
How can I get my Twitter Bootstrap buttons to right align?Change navbar color in Twitter BootstrapWhat is the difference among col-lg-*, col-md-* and col-sm-* in Bootstrap?How to import popper.js?Bootstrap 4 tab.js active states stuckPurpose of the “$=” or “?=” in lit-element examplesHow do I consume a polymer lit-element?Bootstrap popper.js Failed to find a valid digest in the 'integrity' attribute for resourceLit-Element: which event to use for DOM updates?How to test Web Component (lit-element) with jest
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I would like to make use of Lit-Element with Bootstrap.
Currently I have simply imported the external dependancies as suggested here: https://lit-element.polymer-project.org/guide/styles#external-stylesheet
Is there a better way to import these 3rd party dependancies?
Here is my component:
import LitElement, html, css from "../../../third-party-libs/lit-element.js"
class LoginError extends LitElement
static get properties()
return
show: type: Boolean, reflect: true
static get styles()
return css`
div
color: red;
.hide-me
visibility: hidden
`;
constructor()
super();
this.show = false
render()
return html`
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.0/animate.min.css">
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>
<div class="invalid-credentials mb-3 animated $ this.show ? "shake" : "hide-me"">
Invalid credentials, please try again
</div>
`
customElements.define('login-error', LoginError)
I would appreciate any advice on how to clean this up, and how to share this code with multiple components.
bootstrap-4 web-component lit-element
add a comment
|
I would like to make use of Lit-Element with Bootstrap.
Currently I have simply imported the external dependancies as suggested here: https://lit-element.polymer-project.org/guide/styles#external-stylesheet
Is there a better way to import these 3rd party dependancies?
Here is my component:
import LitElement, html, css from "../../../third-party-libs/lit-element.js"
class LoginError extends LitElement
static get properties()
return
show: type: Boolean, reflect: true
static get styles()
return css`
div
color: red;
.hide-me
visibility: hidden
`;
constructor()
super();
this.show = false
render()
return html`
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.0/animate.min.css">
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>
<div class="invalid-credentials mb-3 animated $ this.show ? "shake" : "hide-me"">
Invalid credentials, please try again
</div>
`
customElements.define('login-error', LoginError)
I would appreciate any advice on how to clean this up, and how to share this code with multiple components.
bootstrap-4 web-component lit-element
add a comment
|
I would like to make use of Lit-Element with Bootstrap.
Currently I have simply imported the external dependancies as suggested here: https://lit-element.polymer-project.org/guide/styles#external-stylesheet
Is there a better way to import these 3rd party dependancies?
Here is my component:
import LitElement, html, css from "../../../third-party-libs/lit-element.js"
class LoginError extends LitElement
static get properties()
return
show: type: Boolean, reflect: true
static get styles()
return css`
div
color: red;
.hide-me
visibility: hidden
`;
constructor()
super();
this.show = false
render()
return html`
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.0/animate.min.css">
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>
<div class="invalid-credentials mb-3 animated $ this.show ? "shake" : "hide-me"">
Invalid credentials, please try again
</div>
`
customElements.define('login-error', LoginError)
I would appreciate any advice on how to clean this up, and how to share this code with multiple components.
bootstrap-4 web-component lit-element
I would like to make use of Lit-Element with Bootstrap.
Currently I have simply imported the external dependancies as suggested here: https://lit-element.polymer-project.org/guide/styles#external-stylesheet
Is there a better way to import these 3rd party dependancies?
Here is my component:
import LitElement, html, css from "../../../third-party-libs/lit-element.js"
class LoginError extends LitElement
static get properties()
return
show: type: Boolean, reflect: true
static get styles()
return css`
div
color: red;
.hide-me
visibility: hidden
`;
constructor()
super();
this.show = false
render()
return html`
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/css/bootstrap.min.css" integrity="sha384-GJzZqFGwb1QTTN6wy59ffF1BuGJpLSa9DkKMp0DgiMDm4iYMj70gZWKYbI706tWS" crossorigin="anonymous">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.0/animate.min.css">
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.6/umd/popper.min.js" integrity="sha384-wHAiFfRlMFy6i5SRaxvfOCifBUQy1xHdJ/yoi7FRNXMRBu5WHdZYu1hA6ZOblgut" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.2.1/js/bootstrap.min.js" integrity="sha384-B0UglyR+jN6CkvvICOB2joaf5I4l3gm9GU6Hc1og6Ls7i6U/mkkaduKaBhlAXv9k" crossorigin="anonymous"></script>
<div class="invalid-credentials mb-3 animated $ this.show ? "shake" : "hide-me"">
Invalid credentials, please try again
</div>
`
customElements.define('login-error', LoginError)
I would appreciate any advice on how to clean this up, and how to share this code with multiple components.
bootstrap-4 web-component lit-element
bootstrap-4 web-component lit-element
asked Mar 28 at 14:33
DarynDaryn
1,1433 gold badges14 silver badges33 bronze badges
1,1433 gold badges14 silver badges33 bronze badges
add a comment
|
add a comment
|
1 Answer
1
active
oldest
votes
A few things:
- ShadowDOM only encapsulates DOM and CSS and not JavaScript. So placing your JavaScript into a component may not be the best thing to do.
- Several CSS libraries only work in ShadowDOM if they are, first, loaded on the page and then, second, loaded into the shadowDOM. Especially if you are loading external fonts.
- If you run into problems using LIT you might want to quickly try just making a vanilla JS Web Component to make sure the library isn't getting in the way. Then, once that is working, convert it back to LIT.
- Remember that you do not need to write a Web Component to test ShadowDOM. You can use regular JS to add a shadowRoot to any element and test using CSS and fonts in that shadowDOM.
Good luck
add a comment
|
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55400222%2fhow-do-you-use-bootstrap-with-lit-element%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
A few things:
- ShadowDOM only encapsulates DOM and CSS and not JavaScript. So placing your JavaScript into a component may not be the best thing to do.
- Several CSS libraries only work in ShadowDOM if they are, first, loaded on the page and then, second, loaded into the shadowDOM. Especially if you are loading external fonts.
- If you run into problems using LIT you might want to quickly try just making a vanilla JS Web Component to make sure the library isn't getting in the way. Then, once that is working, convert it back to LIT.
- Remember that you do not need to write a Web Component to test ShadowDOM. You can use regular JS to add a shadowRoot to any element and test using CSS and fonts in that shadowDOM.
Good luck
add a comment
|
A few things:
- ShadowDOM only encapsulates DOM and CSS and not JavaScript. So placing your JavaScript into a component may not be the best thing to do.
- Several CSS libraries only work in ShadowDOM if they are, first, loaded on the page and then, second, loaded into the shadowDOM. Especially if you are loading external fonts.
- If you run into problems using LIT you might want to quickly try just making a vanilla JS Web Component to make sure the library isn't getting in the way. Then, once that is working, convert it back to LIT.
- Remember that you do not need to write a Web Component to test ShadowDOM. You can use regular JS to add a shadowRoot to any element and test using CSS and fonts in that shadowDOM.
Good luck
add a comment
|
A few things:
- ShadowDOM only encapsulates DOM and CSS and not JavaScript. So placing your JavaScript into a component may not be the best thing to do.
- Several CSS libraries only work in ShadowDOM if they are, first, loaded on the page and then, second, loaded into the shadowDOM. Especially if you are loading external fonts.
- If you run into problems using LIT you might want to quickly try just making a vanilla JS Web Component to make sure the library isn't getting in the way. Then, once that is working, convert it back to LIT.
- Remember that you do not need to write a Web Component to test ShadowDOM. You can use regular JS to add a shadowRoot to any element and test using CSS and fonts in that shadowDOM.
Good luck
A few things:
- ShadowDOM only encapsulates DOM and CSS and not JavaScript. So placing your JavaScript into a component may not be the best thing to do.
- Several CSS libraries only work in ShadowDOM if they are, first, loaded on the page and then, second, loaded into the shadowDOM. Especially if you are loading external fonts.
- If you run into problems using LIT you might want to quickly try just making a vanilla JS Web Component to make sure the library isn't getting in the way. Then, once that is working, convert it back to LIT.
- Remember that you do not need to write a Web Component to test ShadowDOM. You can use regular JS to add a shadowRoot to any element and test using CSS and fonts in that shadowDOM.
Good luck
edited Mar 30 at 20:40
answered Mar 30 at 2:04
IntervaliaIntervalia
6,3811 gold badge13 silver badges38 bronze badges
6,3811 gold badge13 silver badges38 bronze badges
add a comment
|
add a comment
|
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Got a question that you can’t ask on public Stack Overflow? Learn more about sharing private information with Stack Overflow for Teams.
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55400222%2fhow-do-you-use-bootstrap-with-lit-element%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown