@@ -25,11 +25,12 @@ import "./styles.css";
2525var mountNode = document.getElementById("root");
2626ReactDOM.render(<App />, mountNode);` ;
2727
28- const tags = snapshot . tags . map ( ele => {
28+ const appFile = snapshot . files [ 0 ] ;
29+ const tags = appFile . fileTags . map ( ( ele ) => {
2930 return ele . slice ( 1 ) ;
3031 } ) ;
3132
32- const templateAppJS = `${ snapshot . imports } import { hot } from 'react-hot-loader/root';
33+ const templateAppJS = `${ appFile . fileImports . join ( '' ) } import { hot } from 'react-hot-loader/root';
3334
3435const App = () => {
3536 return (
@@ -43,33 +44,6 @@ const App = () => {
4344
4445export default hot(App);` ;
4546
46- const templateCSS = `html {
47- box-sizing: border-box;
48- height: 100%;
49- }
50- body {
51- margin: 0;
52- padding-top: 20%;
53- overflow: hidden;
54- background-color: #272727;
55- font-family: "Helvetica Neue";
56- display: flex;
57- justify-content: center;
58- text-align: center;
59- height: 100%;
60- }
61- h1 {
62- color: white;
63- font-size: 3rem;
64- }
65- p {
66- color: white;
67- font-size: 1.5rem;
68- }
69- .default-spans {
70- color: #4338ca;
71- }` ;
72-
7347 const templatePackage = `{
7448"name": "exported-project",
7549"version": "1.0.0",
@@ -223,7 +197,7 @@ module.exports = config;`;
223197 ]
224198}` ;
225199
226- const path = df ( ) ;
200+ const path = df ( ) ; //module to find download folder
227201 const name = 'Exported_Project_' + Math . floor ( Math . random ( ) * 100 ) . toString ( ) ;
228202
229203 //iterate through files array, create file for each, fill with its code key
@@ -235,10 +209,12 @@ module.exports = config;`;
235209 fse . outputFile ( path + `/${ name } /src/${ curr . name } ` , curr . fileCode ) ;
236210 }
237211
212+ const css = snapshot . cssCode ;
213+
238214 fse . outputFile ( path + `/${ name } /dist/index.html` , templateHTML ) ;
239215 fse . outputFile ( path + `/${ name } /src/index.js` , templateIndexJS ) ;
240216 fse . outputFile ( path + `/${ name } /src/App.js` , templateAppJS ) ;
241- fse . outputFile ( path + `/${ name } /src/styles.css` , templateCSS ) ;
217+ fse . outputFile ( path + `/${ name } /src/styles.css` , css ) ;
242218 fse . outputFile ( path + `/${ name } /.gitignore` , templateGitIgnore ) ;
243219 fse . outputFile ( path + `/${ name } /package.json` , templatePackage ) ;
244220 fse . outputFile ( path + `/${ name } /README.md` , templateReadMe ) ;
0 commit comments