File tree Expand file tree Collapse file tree 1 file changed +4
-2
lines changed
Expand file tree Collapse file tree 1 file changed +4
-2
lines changed Original file line number Diff line number Diff line change @@ -28,7 +28,6 @@ function ratio(part, total) {
2828 */
2929const analyze = ( css ) => {
3030 const start = Date . now ( )
31- let lines = css . split ( / \r ? \n / g)
3231
3332 /**
3433 * Recreate the authored CSS from a CSSTree node
@@ -55,16 +54,19 @@ const analyze = (css) => {
5554
5655 const startParse = Date . now ( )
5756
57+ /** @type import('css-tree').CssNode */
5858 const ast = parse ( css , {
5959 parseCustomProperty : true , // To find font-families, colors, etc.
6060 positions : true , // So we can use stringifyNode()
61+ /** @param {string } comment */
6162 onComment : function ( comment ) {
6263 totalComments ++
6364 commentsSize += comment . length
6465 } ,
6566 } )
6667
6768 const startAnalysis = Date . now ( )
69+ let linesOfCode = ast . loc . end . line - ast . loc . start . line + 1
6870
6971 // Atrules
7072 let totalAtRules = 0
@@ -510,7 +512,7 @@ const analyze = (css) => {
510512 return {
511513 stylesheet : {
512514 sourceLinesOfCode : totalAtRules + totalSelectors + totalDeclarations + keyframeSelectors . size ( ) ,
513- linesOfCode : lines . length ,
515+ linesOfCode,
514516 size : css . length ,
515517 comments : {
516518 total : totalComments ,
You can’t perform that action at this time.
0 commit comments