Tools to compile CSS code automatically in Sublime Text 3

Asked

Viewed 24 times

1

I’m having a hard time passing my code to production. I want to remove my comments and change the class name, but I couldn’t find one tool to compile code as production generating a zip file as output, with the same folder structure.

To minimize the class name I use the:

https://github.com/JPeer264/node-rcs-core

But the process is totally manual and I need to take great care not to get missing any file if I don’t need to recompile again.

My solution would be to take a single page with individual html, css and js. Read the entire folder and only then generate the new files with the same structure.

const rcs=require('rcs-core');
const fs=require('fs');

rcs.fillLibraries(fs.readFileSync('./antes/sacola.css', 'utf8'));

//Antes
const css = rcs.replace.css(fs.readFileSync('./antes/sacola.css', 'utf8'));
const js1 = rcs.replace.js(fs.readFileSync('./antes/sacola.js', 'utf8'));
const js2 = rcs.replace.js(fs.readFileSync('./antes/sacola-util.js', 'utf8'));
const html = rcs.replace.html(fs.readFileSync('./antes/index.html', 'utf8'));
 
//Depois
fs.writeFileSync('./depois/sacola.css', css);
fs.writeFileSync('./depois/sacola.js', js1);
fs.writeFileSync('./depois/sacola-util.js', js2);
fs.writeFileSync('./depois/index.html', html);

  • Have you considered using the fs.readdir (or fs.readdirSync) to do something like?

  • Thank you so much for the help, but I’m still having doubts about how to do the output.

  • I use rcs because it plays the role of rewriting the class names very well. But what is more important now is to generate this compiled and minified code. I’ve been searching for a tool for so many days, I don’t even care to pay K.

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.