Security News
The Risks of Misguided Research in Supply Chain Security
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
ember-css-properties
Advanced tools
This addon let's you easily and safely bind CSS properties in your Ember templates. This creates a reusable helper to avoid the Binding Style Attributes Deprecation added in Ember 1.11.
ember install ember-css-properties
The ember-css-properties
addon provides a handlebars helper called css-properties
that can be used to safely bind CSS properties to elements in templates.
This will use cssesc
to escape CSS safe strings for each property, and it will return an htmlSafe
string to handle the deprecation warning.
For example to bind the background color of a div to a favoriteColor
property:
<div class="headline" style="{{css-properties background-color=favoriteColor}}"></div>
The css-properties
helper can also be used with multiple style properties at once:
<div class="headline" style="{{css-properties background-color=favoriteColor color=secondFavoriteColor}}"></div>
Finally for libraries and larger computed styles, the css-properties
function can also be used with a single object of style properties (see notes and warnings below):
<div class="headline" style="{{css-properties myStyles}}"></div>
myStyles: {
color: 'red',
width: '20%',
'background-image': 'url(http://placecage.com/200/200)'
}
This addon only creates escaped CSS strings using cssesc. For performance, flexibility, and complexity reasons it does not:
borderRight
to border-right
)border: { right: '1px solid black }
to border-right: 1px solid black
)The css-properties
helper can be used as a lower level primitive by component styling libraries or other packages to provide this kind of functionality.
This addon is tested against Ember >2.12, but should work with all 2.* releases and possibly even further back. Please submit an issue or PR if this does not support your Ember release.
MIT
FAQs
Easily and safely bind CSS properties using the `style` attribute.
The npm package ember-css-properties receives a total of 1,381 weekly downloads. As such, ember-css-properties popularity was classified as popular.
We found that ember-css-properties demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Snyk's use of malicious npm packages for research raises ethical concerns, highlighting risks in public deployment, data exfiltration, and unauthorized testing.
Research
Security News
Socket researchers found several malicious npm packages typosquatting Chalk and Chokidar, targeting Node.js developers with kill switches and data theft.
Security News
pnpm 10 blocks lifecycle scripts by default to improve security, addressing supply chain attack risks but sparking debate over compatibility and workflow changes.