用Jekyll设置Polymer? [英] Setting up Polymer with Jekyll?

查看:83
本文介绍了用Jekyll设置Polymer?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试在Jekyll网站上使用Polymer,但我不知道如何进行设置.我下载并可以运行Polymer Starter Kit. Polymer在app目录中具有页面内容,但是如果我尝试从此文件夹中设置并运行Jekyll,则会遇到很多错误,因为Polymer index.html找不到资源(因为根目录为不同).

I'm trying to use Polymer with a Jekyll site, but I can't figure out how to get things set. I downloaded and can run the Polymer Starter Kit. Polymer has the page contents in the app directory, but if I try to set up and run Jekyll from this folder, I get a load of errors because the Polymer index.html can't find the resources (because the root directory is different).

Jekyll和Polymer一起工作的正确设置和结构方式是什么?

What is the correct way to set-up and structure for Jekyll and Polymer to work together?

推荐答案

我刚刚回到这个话题,自去年夏天以来,情况有了很大的改善.我根据聚合物入门工具包(1.2.3).但是我更改了defaultserve任务的行为,以运行Jekyll服务并在shell中进行构建:

I just came back to this, and things are much improved since last summer. I made a gulpfile based on that for the Polymer Starter Kit (1.2.3). But I changed the behavior of the default and serve tasks to run Jekyll serve and build in the shell:

var spawn = require('child_process').spawn;
var argv = require('yargs').argv;

gulp.task('jekyllbuild', function(done) {
  return spawn('bundle', ['exec', 'jekyll', 'build'], { stdio: 'inherit' })
      .on('close', done);
});

// Build production files, the default task
gulp.task('default', ['clean'], function(cb) {
  // Uncomment 'cache-config' if you are going to use service workers.
  runSequence(
    'jekyllbuild',
    ['ensureFiles', 'copy', 'styles'],
    'elements',
    ['images', 'fonts', 'html'],
    'vulcanize', // 'cache-config',
    cb);
});

gulp.task('serve', function(done) {
  if (argv.port) {
    return spawn('bundle', ['exec', 'jekyll', 'serve', '--port=' + argv.port], { stdio: 'inherit' })
        .on('close', done);
  } else {
    return spawn('bundle', ['exec', 'jekyll', 'serve'], { stdio: 'inherit' })
        .on('close', done);
  }
});

使用BrowserSync将产生更清洁的效果,但这是获得Jekyll功能和硫化生产优势的简单方法. (请注意,您还必须安装yargs软件包以处理端口规范.)我的整个gulpfile是此处.

Using BrowserSync would have a much cleaner effect, but this is a simple way to get Jekyll functionality and the benefit of vulcanization for production. (Note that you also have to install the yargs package to handle port specification.) My whole gulpfile is here.

这篇关于用Jekyll设置Polymer?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆