Skip to content

Commit

Permalink
upd
Browse files Browse the repository at this point in the history
  • Loading branch information
atherdon committed Sep 6, 2021
1 parent 0915412 commit 492c106
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 2 deletions.
2 changes: 0 additions & 2 deletions src/parser.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ const {
// and ruined a lot of our logic
fullTemplate,


fullTemplateOLD
} = require('atherdon-newsletter-js-layouts');

Expand All @@ -19,7 +18,6 @@ const {
} = require('markup-generator');

const {

writeReactComponent,
generateTemplateName,

Expand Down
25 changes: 25 additions & 0 deletions src/react/methods.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
const { write } = require('markup-generator');

const reactComponent = `
import React from "react";
const Content = () => {
return (
<>
{content}
</>
);
};
export default Content;
`;

function reactComponentReplace(content){
return reactComponent.replace(/{content}/g, content);
}

function writeReactComponent(fileName, content, dir = 'generated', message) {

const result = reactComponentReplace(content);
write(fileName, result, dir, message);
}
2 changes: 2 additions & 0 deletions src/utils.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const fs = require('fs');
const { write } = require('markup-generator');


const reactComponent = `
import React from "react";
Expand All @@ -26,6 +27,7 @@ function writeReactComponent(fileName, content, dir = 'generated', message) {
}



const generateTemplateName = (suffix, ext = 'html') => `${suffix}-${Date.now()}.${ext}`;


Expand Down

0 comments on commit 492c106

Please sign in to comment.