Good morning, is there a prepiler solution for JavaScript like Sass for CSS ?
The only features I need are the partials prepiling (to have fewer js files) and the auto-pression of the file.
I googled for Coffeescript but it's not what I'm looking for and because I don't want a different syntax..
If is there a software like Koala for Sass would be appreciated but even from mand line (I'm on Windows) is ok, thank you in advance!
PS: with partials I mean:
@import "file.js"
The tool find this and replace it with the content of the file, creating a new file, maybe in another folder specified by me (As I said, like Koala)
Good morning, is there a prepiler solution for JavaScript like Sass for CSS ?
The only features I need are the partials prepiling (to have fewer js files) and the auto-pression of the file.
I googled for Coffeescript but it's not what I'm looking for and because I don't want a different syntax..
If is there a software like Koala for Sass would be appreciated but even from mand line (I'm on Windows) is ok, thank you in advance!
PS: with partials I mean:
@import "file.js"
The tool find this and replace it with the content of the file, creating a new file, maybe in another folder specified by me (As I said, like Koala)
Share Improve this question edited Jun 23, 2015 at 11:44 Manuel Di Iorio asked Jun 23, 2015 at 10:01 Manuel Di IorioManuel Di Iorio 3,7915 gold badges30 silver badges31 bronze badges 4- 3 I don't want a different syntax?? So, you want different features with the same syntax? That doesn't make sense. SASS is a different syntax than CSS, as is SCSS. Sounds like you just want a task runner like Gulp or Grunt – CodingIntrigue Commented Jun 23, 2015 at 10:02
- 1 You're definitely looking for a task runner, google Gulp ! – Kaz Commented Jun 23, 2015 at 10:06
- "Partials" is pretty meaningless when you're talking about JavaScript. – Andy Commented Jun 23, 2015 at 10:09
- (1) "different syntax": means that should don't pletely change the syntax like coffeescript but only adding some features like scss - (2) "partials": like @import "file.js" – Manuel Di Iorio Commented Jun 23, 2015 at 11:36
3 Answers
Reset to default 2Javascript is directly interpreted by your browser so there is no "partials prepiling" stuff.
What you are looking for is a task runner like Gulp or Grunt that can launch a task (amongst others) that will concatenate your files.
Here is a concat task for Gulp
When you say "prepiled" you mean "concatenate and minify", yes they are technically different because the "piled" code is still in JS, but they are essentially the same thing.
Google has a tool call Closure "Compiler" that is probably what you are looking for.
Found this answer, by Andy Tran, to the question "What are the HTML and JavaScript equivalents of Sass?":
I’m sure there are plenty of options but I’ve only heard of CoffeeScript, TypeScript, Babel, and LiveScript.
[...]
CoffeeScript does create some shorthand versions of certain things aimed to make it easier to read/write, but in my opinion, I found it just to be more messy.
Babel was the second that I picked up and I immediately loved it. Babel allows you to write the newer version of EMCAScript (ES6, ES7) but piles it to plain old JavaScript to support older versions browsers and IE that doesn’t support have support for it.
TypeScript and LiveScript, I’m not familiar about. However, I’ve heard a lot of positive feedback on TypeScripts and everyone been remending me to check it out and use it instead of CoffeeScript!
Hope it helps!