Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/36.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js Pug:从节点_模块访问引导_Node.js_Twitter Bootstrap_Pug - Fatal编程技术网

Node.js Pug:从节点_模块访问引导

Node.js Pug:从节点_模块访问引导,node.js,twitter-bootstrap,pug,Node.js,Twitter Bootstrap,Pug,我正在使用pug输出html,我将其用于以后的pdf生成和html pdf 我的控制器: // read file var source = fs.readFileSync(path.resolve(__dirname, 'templates/pdf.pug'), 'utf-8'); // compile pug template and output html var template = pug.compile(source); var html = tem

我正在使用pug输出html,我将其用于以后的pdf生成和html pdf

我的控制器:

// read file
    var source = fs.readFileSync(path.resolve(__dirname, 'templates/pdf.pug'), 'utf-8');

    // compile pug template and output html
    var template = pug.compile(source);
    var html = template(data)
我的模板

doctype html
html
  head
    title Merapi Export
    link(rel='stylesheet', href='/node_modules/bootstrap/dist/css/bootstrap.min.css')
  body
    h1 Merapi Export

有没有办法直接从节点模块集成引导功能?

事实证明,您必须在html pdf(用于生成pdf)的选项中为您的pug模板设置一个基本目录:

完成此操作后,您可以如下方式访问引导:

link(rel='stylesheet', href='../../../../../../node_modules/bootstrap/dist/css/bootstrap.min.css')

事实证明,您必须在html pdf(用于生成pdf)的选项中为您的pug模板设置基本目录:

完成此操作后,您可以如下方式访问引导:

link(rel='stylesheet', href='../../../../../../node_modules/bootstrap/dist/css/bootstrap.min.css')