我有这个玉文件:
!!! 5
html
head
title test include
style(type='text/css')
//- DOES NOT WORK!
include test.css
body
//- works
include test.css
div
//- works
include test.css
Run Code Online (Sandbox Code Playgroud)
输出:
$ jade -P test.jade
rendered test.html
$ cat test.html
<!DOCTYPE html>
<html>
<head>
<title>test include</title>
<style type="text/css">
//- DOES NOT WORK!
include test.css
</style>
</head>
<body>body { color: peachpuff; }
<div> body { color: peachpuff; }
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
当然,我可以简单地链接css文件,但我不想.
我想用JShell运行整个文件,如:
$ jshell my-jshell-skript.java
Run Code Online (Sandbox Code Playgroud)
例如,在哪里我的内容my-jshell-skript.java是40 + 2;.
或者可选的可执行文件:
#!/usr/bin/jshell
40 + 2
Run Code Online (Sandbox Code Playgroud)
现在这可能吗?还是我仍然需要采用Java-Main-Class的旧方法?
在Windows上,我仍然没有解决方案:
C:\JDKs\jdk9.0.0.0_x64\bin>type foo.jsh
1 + 1
C:\JDKs\jdk9.0.0.0_x64\bin>jshell.exe foo.jsh
| Welcome to JShell -- Version 9
| For an introduction type: /help intro
jshell> /exit
| Goodbye
C:\JDKs\jdk9.0.0.0_x64\bin>
Run Code Online (Sandbox Code Playgroud)
JShell开始完全忽略我的文件.这是一个错误吗?
事实证明这是我的foo的内容.似乎1 + 1只能"在运行中"工作,而不是从文件中读取:
C:\JDKs\jdk9.0.0.0_x64\bin>type foo.jsh
System.out.println("foo");
C:\JDKs\jdk9.0.0.0_x64\bin>jshell.exe foo.jsh
foo
| Welcome to JShell -- Version 9
| For an introduction type: /help intro
jshell> /exit
| Goodbye
C:\JDKs\jdk9.0.0.0_x64\bin>
Run Code Online (Sandbox Code Playgroud)