I've a file like following
// Variables
// Greys
@linkColor: #000;
// Links
@linkColorHover: darken(@linkColor, 15%);
// Fonts
@sansFontFamily: "Helvetica Neue", Helvetica, Arial, sans-serif;
@altFontFamily: @sansFontFamily;
// Size
@baseLineHeight: 20px;
I can read the file line-by-line. Is there any way to check a line, if it's not comment by regular expression.
This regular expression:
var isCommentLine = function (line) {
var rex = /^\s*\/\/.*$|^\s*\/\*.*\*\/\s*$/;
return rex.test(line);
}
true for the following 4 lines:
// hello world
// some comment
/* other comment */
/* yet another one */
false for multiline comments
/* hello
* thing
bing
world */
false for mixed code - comment lines:
color: red; // red color
So if your usecase is ok with this then you can use it