我有一个scss文件,我使用scss将其编译成一个css文件。 scss to css编译器会检测scss文件中的错误,但它似乎过于宽容。也就是说,即使我输入样式属性的名称,它也会编译而没有错误。当scss文件中的样式属性在css3或导入的功能中不存在时,有没有办法让它返回错误?也有可能为样式写一个无效的值,但我知道这更复杂,我不是要求它。
答案 0 :(得分:1)
Ruby wrapper周围有W3C CSS Validator,因此您可以编写一个简单的脚本来检查scss中的输出css。
我还发现this与Compass集成,因此如果您使用Compass来编译scss,它可能会有所帮助。我还没有使用过这个,所以我不确定它是如何工作的,但我对W3C CSS Validator有很好的体验。
答案 1 :(得分:0)
我真的很喜欢以某种方式内置到 rails 或我的开发环境中。
我发现这个在线工具非常有用(它可以发现错误,但也会提示我正在做的可能导致意外结果的事情)
http://beautifytools.com/scss-compiler.php
复制粘贴 def freqSort(nums)
#This section makes an ordered hash map that is ordered from least to greatest frequency
hash_map = {x:0 for x in nums}
hash_lst = []
for num in nums:
hash_map[num] += 1
hash_lst = sorted(hash_map.items(), key=lambda x: x[1], reverse=True)
hash_lst.reverse()
#This section creates a list of frequencies for each type of number in the list
key_lst = []
for key in hash_lst:
key_lst.append(key[1])
interval_map = {x:0 for x in key_lst}
for num in key_lst:
interval_map[num] += 1
#This section initializes an array based on the number of frequencies
array_lst = []
for num in interval_map:
array_lst.append([])
#This section appends numbers into their corresponding frequencies
i = 0
j = 0
for tup in hash_lst:
array_lst[i].append(tup[0])
if j+1 != len(key_lst):
if key_lst[j] != key_lst[j+1]:
i += 1
j += 1
k = 0
#array_lst at this point looks like [[5, -1],[4, -6],[1]]
#This section multiplies each number in each array based on the frequency it is grouped in
for interval in interval_map:
array_lst[k] = np.repeat(array_lst[k], interval)
k+=1
result_lst = []
for array in array_lst:
result_lst.append(sorted(list(array), reverse=True))
return result_lst
文件到左侧并点击“编译 SCSS”
答案 2 :(得分:0)
我建议,如果你想要一个内置到你的 NodeJS 开发中的验证器(可能还有其他用于不同语言的验证器,但这是我发现的), scss 验证器:https://www.npmjs.com/package/scss-validator