小编use*_*370的帖子

如何在jade中包含css文件(不链接它)

我有这个玉文件:

!!! 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文件,但我不想.

node.js pug

10
推荐指数
2
解决办法
1万
查看次数

如何运行JShell文件?

我想用JShell运行整个文件,如:

$ jshell my-jshell-skript.java
Run Code Online (Sandbox Code Playgroud)

例如,在哪里我的内容my-jshell-skript.java40 + 2;.

或者可选的可执行文件:

#!/usr/bin/jshell
40 + 2
Run Code Online (Sandbox Code Playgroud)

现在这可能吗?还是我仍然需要采用Java-Main-Class的旧方法?

编辑1:Windows问题

在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开始完全忽略我的文件.这是一个错误吗?

编辑2:Windows问题的解决方案

事实证明这是我的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)

java java-9 jshell

9
推荐指数
2
解决办法
2723
查看次数

标签 统计

java ×1

java-9 ×1

jshell ×1

node.js ×1

pug ×1