Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Suggestion: style tag/attribute selector for Polymer

See original GitHub issue

As mentioned in, gulp-minify-inline allows a cssSelector.

clean-css breaks Polymer’s CSS, so an easy work-around is to simply ignore any style tags that are marked is="custom-style".

This allows you to still clean non-Polymer style tags.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Comments:5

github_iconTop GitHub Comments

alexlamslcommented, Feb 13, 2016

One way to achieve what you want is to utilise ignoreCustomFragments

> minify(`
...   <div id="drawer" style$="[[_computeDrawerStyle(drawerWidth)]]">
...     <span style="font: 12px bold">content</span>
...   </div>
... `, {
.....   customAttrAssign: [/\$=/],
.....   ignoreCustomFragments: [/style\$?="\[\[.*?\]\]"/],
.....   minifyCSS: true,
.....   collapseWhitespace: true
..... });

'<div id="drawer" style$="[[_computeDrawerStyle(drawerWidth)]]"><span style="font:12px 700">content</span></div>'
cpboydcommented, Feb 14, 2016

That works, thanks.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Styling local DOM - Polymer Project
Polymer uses Shadow DOM styling rules for providing scoped styling of the element's local DOM. Scoped styles should be provided via <style> tags...
Read more >
Overview of styling possibilities · Issue #1821 - GitHub
Create a file with just the <style> tag (with the the custom-style attribute). Any property or mixin defined within a :root selector will...
Read more >
Attribute selectors - CSS: Cascading Style Sheets | MDN
The CSS attribute selector matches elements based on the presence or value of a given attribute.
Read more >
css styling using custom attributes to make it more readable ...
This is not a good practice. How to use custom attributes? First, you should use data attributes instead of full-custom attributes:
Read more >
CSS Attribute Selector - W3Schools
selector is used to select elements whose attribute value ends with a specified value. The following example selects all elements with a class...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found