javascript - Is there any good tool or plug-in to convert all externally imported css into inline styles?
某草草
某草草 2017-05-18 10:53:51
0
4
718

As we all know, emails must have inline styles to take effect.
All external styles of web pages must be converted into internal styles called email templates. Are there any good plug-ins?

某草草
某草草

reply all(4)
巴扎黑

https://github.com/Rozbo/html...

html-packer can take html's <script>, <link>, and <img> (including *.svg sources) tags into html-self.
More than that, it also can compress to minimize it.

I have never tried it. From the introduction, this plug-in seems to work. It is said that it can not only convert css, but also pictures and svg. Test it yourself. . .

洪涛

https://www.google.com/#safe=...

There are a lot of them on github. . Why don’t you google it

给我你的怀抱

This should help you, gulp plug-ingulp-inline-css

https://www.npmjs.com/package...

世界只因有你

I don’t know about the plug-in
But you can put the css into any editor
and then replace the text with regular expressions
just change the style to the internal style format

For example:

.inner {
    width: 300px,
    height: 500px
}

First go to the classname line: .*{n and replace it with the ``null character.*{n 替换为``空字符
在去掉 } 为 空
然后匹配 ^s*"
: =
nRemove} to be empty
Then match ^s* to "

go to : for =

go to n
...style="width=300;height=500px"

Until it becomes the format you want for the inline style:



If there are not many tags, just copy and add them one by one.

If there are a lot of tags,
write all the above processes into js, ​​match the corresponding tags through classname, and add the corresponding styles

By the way

Isn’t this what you call a template plug-in script

It’s better to ask for others than to ask for yourself🎜 🎜goodluck🎜
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template