0

I have some css;

<style amp-custom>
     form.amp-form-submit-success [submit-success],
     form.amp-form-submit-error [submit-error]{
     margin-top: 16px;
     }
     .bottommargin10{margin-bottom:10px;}
        .comment-msg {
            margin-top: 5px;
            margin-bottom: 0;word-break:break-all;    color: #555;font-size:14px;
        }
        .paddingleft10{padding-left:10px;}
        form.amp-form-submit-success > textarea {
          display: none
        }
        .align-left: {
          margin-left: 898px;
        }
        .button {
            background-color: #4CAF50; /* Green */
            border: none;
            color: white;
            padding: 15px 32px;
            text-align: center;
            text-decoration: none;
            display: inline-block;
            font-size: 16px;
            margin: 4px 2px;
            cursor: pointer;
        }
  </style>

I am creating a new html file whenever the I create a new blog in my site.

Here is the code,

 blogs.findOne({blog_id: id}).exec(function (err, results) {
        if (err) {
            helper.logs('editBlog','blog',err,'console');  
            return console.error(err);
        }
        if (results) {
            var fileName = 'public/test_amp/'+results.blog_id+'.html';
            var stream = fs.createWriteStream(fileName);
        }
   });

So whenever ii find a blog by id I should create a new html page. Every page should have a css and that is in common for all pages. SO How can I write this long css into the file?

James Z
  • 12,209
  • 10
  • 24
  • 44
TSR
  • 5
  • 1
  • 3
  • Typically, one would use a template engine such as handlebars, DUST, EJS or PUG. Then, you define the template once. The CSS can be either built into the template or included from another file and then your unique content can be generated and filled in each separate page as it is rendered. – jfriend00 Jun 12 '17 at 06:34
  • Possible duplicate of [Writing files in Node.js](https://stackoverflow.com/questions/2496710/writing-files-in-node-js) – laltin Jun 12 '17 at 19:57

0 Answers0