Skip to content

Commit

Permalink
feature(RemoveInlineCss) #22 Remove inline css for all elements
Browse files Browse the repository at this point in the history
  • Loading branch information
Guillem Blanché authored and rkazakov committed Jun 30, 2022
1 parent b47ca63 commit a21cac0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
2 changes: 2 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ module.exports = async (html, options) => {

/* head */

$('*').removeAttr('style');

/* main amp library */
$('head script[src="https://cdn.ampproject.org/v0.js"]').remove();
$('head').prepend('<script async src="https://cdn.ampproject.org/v0.js"></script>');
Expand Down
8 changes: 8 additions & 0 deletions test/styles.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,12 @@ describe('inline styles', () => {
{ cwd: __dirname.split(path.sep).pop() },
);
});

test('should remove inline style', () => {
assert(
'<span style="background-color: red">hello</span>',
'<span>hello</span>',
{ cwd: __dirname.split(path.sep).pop() },
);
});
});

0 comments on commit a21cac0

Please sign in to comment.