Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
amps-in-the-trunk
Advanced tools
Readme
amps-in-the-trunk turns HTML into AM HTML: changing <img>
into <amp-img>
, including:
<pre><code>
blocks.It also comes with express middleware so you can res.renderAMP()
. Woo!
The biggest challenges for AMP are:
Most apps use a templating engine to generate their HTML. So as a developer:
<script>
tagsSo you're using express, this looks like
layout=
to specify the AMP layout rather than your normal oneres.renderAMP(view, local)
to render HTML and convert it to AMP:// Load the module and pass in any overrides
// imageOverrides optional Object - see below
// enableCodeHighlighting optional Boolean - see below
// languageSubset - optional Array - for highlightjs. See http://highlightjs.readthedocs.io/en/latest/api.html#highlightauto-value-languagesubset
var ampsInTheTrunk = require('amps-in-the-trunk')(imageOverrides, enableCodeHighlighting, languageSubset)
// Enable the renderAMP Express middleware
app.use(ampsInTheTrunk.renderAMP);
// Handle a route by respondingwith an AMP page
router.get('/blog', function(req, res){
res.renderAMP('blog-index', {
'title': 'My Blog',
inlineStyles,
styles: [ 'style', 'articles']
});
});
amps-in-the-trunk sets images to responsive
by default. You can change that with imageOverrides
. Also most SVGs have incorrect sizing. You could fix the SVGs, or you could override them with imageOverrides
.
var imageOverrides = {
'logo.svg': {
width: 22,
height: 22,
layout: 'fixed'
},
'rss.svg': {
width: 26,
height: 16,
layout: 'fixed'
}
}
var ampsInTheTrunk = require('amps-in-the-trunk')(imageOverrides)
<pre><code>
blocks using highlight.jsIf you want syntax highlighting, AMPS in the Trunk will use highlight.js to highlight the specific blocks.
I tried html-to-amp but that uses html-to-article-json first and it lost images. I don't care about article.json
and I don't care about non-AMP alternative formats. I just wanted an AMP version of my HTML that didn't lose any data and would pass the AMP validator.
This is the first version of the module, created really for my own needs. I'm quite happy to take pull requests for additional features.
Because amplify
and html-to-amp
were taken and because House of Pain
FAQs
Turns HTML in Google AMP HTML. Includes express middleware.
The npm package amps-in-the-trunk receives a total of 21 weekly downloads. As such, amps-in-the-trunk popularity was classified as not popular.
We found that amps-in-the-trunk 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.