我试图了解css源地图的工作原理.我创建了一个非常简单的scss文件.
#navbar { color: black; }
当我编译上面的scss时,我得到以下映射文件.
{ "version": "3","mappings": "AAAA,OAAQ;EACP,KAAK,EAAE,KAAK","sources": ["test.scss"],"file": "test.css" }
当我解码“映射”时,我得到以下值.
0) [0,0],[7,8] 1) [2,1,-7],[5,5],[2,2],5]
这些价值观是什么?
解决方法
我在
http://www.thecssninja.com/javascript/source-mapping的“Base64 VLQ和保持源映射很小”一节下找到了一个例子.
The above diagram AAgBC once processed further would return 0,32,16,1 – the 32 being the continuation bit that helps build the following value of 16. B purely decoded in Base64 is 1. So the important values that are used are 0,1. This then lets us know that line 1 (lines are kept count by the semi colons) column 0 of the generated file maps to file 0 (array of files 0 is foo.js),line 16 at column 1.