search

Home  >  Q&A  >  body text

javascript - Is there any good tool or plug-in to convert all externally imported css into inline styles?

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?

某草草某草草2805 days ago734

reply all(4)I'll reply

  • 巴扎黑

    巴扎黑2017-05-18 10:55:51

    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. . .

    reply
    0
  • PHP中文网

    PHP中文网2017-05-18 10:55:51

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

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

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-05-18 10:55:51

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

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

    reply
    0
  • 世界只因有你

    世界只因有你2017-05-18 10:55:51

    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🎜

    reply
    0
  • Cancelreply