Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
amps-in-the-trunk
Advanced tools
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 2 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.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.