我正在考虑从SCSS语法转换为SASS。
我不清楚的一件事是如何导入其他文件,因为与SCSS相比,SASS似乎缺乏大量指南。
在scss中,我将以下内容用于我的main.scss
import java.util.Scanner;
public class P7_MethodTester
{
public static void main(String[] args){
System.out.println("Enter v to count vowels, w to count words, and q to quit");
Scanner in = new Scanner(System.in);
System.out.print("Enter a letter: ");
String str = in.next();
while(str != "q")
{
if(str.equals("w")){
System.out.println("Please input your sentence: ");
String w = in.next();
System.out.println("You input " + countWords(str) + " words");
}
else if(str.equals("v")){
System.out.println("Please input your sentence: ");
String v = in.next();
System.out.println("You input " + countVowels(str) + "vowels");
}
else{
System.out.println("Program terminated");
}
}
}
public static int countWords(String w){
int wordCount = 0;
boolean word = false;
int endOfLine = w.length() - 1;
for (int i = 0; i < w.length(); i++) {
if (Character.isLetter(w.charAt(i)) && i != endOfLine) {
word = true;
} else if (!Character.isLetter(w.charAt(i)) && word) {
wordCount++;
word = false;
} else if (Character.isLetter(w.charAt(i)) && i == endOfLine) {
wordCount++;
}
}
return wordCount;
}
public static int countVowels(String v){
int vowels_count = 0;
for (int i = 0; i < v.length(); i++) {
char current_char = Character.toLowerCase(v.charAt(i));
if (current_char == 'a' || current_char == 'e' || current_char == 'o'
|| current_char == 'i' || current_char == 'u' || current_char == 'y') {
vowels_count += 1;
}
}
return vowels_count;
}
}
所以在sass中,那会是
@include "folder/_file.scss";
或者我走错了路?
答案 0 :(得分:0)
来自official Sass documentation:
@import
Sass中的@import指令不需要引号,尽管它们 可能用过了。例如,这个SCSS:
@import "themes/dark"; @import "font.sass";
将是这个Sass:
@import themes/dark @import font.sass