css framework for an app with existing stylesheet

前端 未结 5 1705
野的像风
野的像风 2020-11-27 14:53

I am building a chrome extension that attaches a widget sort of thing to gmail message. It appears below every email (something like a gmail contextual gadget) when the user

5条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-11-27 15:25

    2016 Update: A future way to mitigate this issue (rather than having to recompile bootstrap) is to take advantage of web components, specifically shadow DOM. This allows your app to be self contained (almost like an iFrame) without the web browser having to open a separate page / losing the ability to communicate between pages.

    say your component is contained in

    ...

    You can move what's inside that div to a tag in your head, eg.

    
    

    Your template can include all the bootstrap link tags and js you want. Then in your javascript/bookmarklet, you can write

    var pluginRoot = document.querySelector('plugin').createShadowRoot();
    var template = document.querySelector('#template');
    var clone = document.importNode(template.content, true);
    pluginRoot.appendChild(clone);
    

    You can read a lot more about Web Components (along with Shadow DOM) here: http://webcomponents.org/articles/introduction-to-shadow-dom/

提交回复
热议问题