Beispiel #1
0
        public ActionResult Index()
        {
            var readAllText = System.IO.File.ReadAllText(@"C:\Projects\Mjml\test.mjml");

            Mjml.PathRepository.NodePath = @"C:\Program Files\nodejs\node.exe";
            Mjml.PathRepository.NpmPath  = @"C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js";
            Mjml.PathRepository.TmpPath  = Path.GetTempPath();

            return(Content(Mjml.Render(readAllText)));
        }
Beispiel #2
0
        static void Main(string[] args)
        {
            Mjml.PathRepository.NodePath = @"C:\Program Files\nodejs\node.exe";
            Mjml.PathRepository.TmpPath  = Path.GetTempPath();

            var mjmlTemplate = "<mjml><mj-body><mj-section><mj-column><mj-image width=\"100px\" src=\"/assets/img/logo-small.png\"></mj-image><mj-divider border-color=\"#F45E43\"></mj-divider><mj-text font-size=\"20px\" color=\"#F45E43\" font-family=\"helvetica\">Hello World</mj-text></mj-column></mj-section></mj-body></mjml>";
            var outputHtml   = Mjml.Render(mjmlTemplate);

            Console.Write(outputHtml);

            Console.ReadKey();
        }