Coder Social home page Coder Social logo

Comments (7)

oxUnd avatar oxUnd commented on May 30, 2024

http://fex-team.github.io/fis3/docs/api/config-glob.html

from fis3.

oxUnd avatar oxUnd commented on May 30, 2024

修正回复


deploy 的疑惑

  1. 你的 public 是第一个 deploy 插件的目标存储地址,而第二个 deploy 是你要把第一个目标地址下产出的文档上传。那么当你没有第一个 deploy 执行产出的时候是无法做到第二个deploy上传成功,因为你第二个 match 是第一个的产出目标地址。

  2. 当然我们设定的时候并没有设定这样的一个deploy 上传流程,我们的设计是所有的文件都 match 到一个 deploy 属性,而这个属性决定这个文件该到什么地方去。而 match 的对象是源码;如果按照你的这种用法,就相当于 deploy 上挂了俩 task,第一个 task 执行完的结果传给第二个去上传。

  3. 如果想做到你上面的双 task 的操作,应该是给某一些源码文件设置 deploy 属性,只是这个 deploy 属性上挂两个 task 进行处理。

    fis.match('{css/*.css,less/g.less,js/*.js,html/*.html,img/**}', {
      deploy: [function () {
       // 这个过程进行挪位置,比如把上面这些资源都挪到 publish 下
       }, fis.plugin('http-push', {})]
    });
  4. 更好的做法

    fis.match('{css/*.css,less/g.less,js/*.js,html/*.html,img/**}', {
      release: '/publish/$0',
      url: '$0'
    });
    
    fis.media('test').match('{css/*.css,less/g.less,js/*.js,html/*.html,img/**}', {
      deploy: fis.plugin('http-push', {
        receiver: 'http://my-host/receiver2.php',
        to: '/data/wapstatic/monkeytao/now'
      })
    });

    注意对产出路径的处理

相对路径

请参考插件 fis3-hook-relative

from fis3.

yolio2003 avatar yolio2003 commented on May 30, 2024

0 麻烦去掉上面 recever2.php 的地址。。。多谢!
1 按照上面的方法 deploy 疑问解除了,但是 url:'$0' 很不解,文档代码都没找到url的逻辑是怎样的。
我使用之后,publish 目录下直接多了一层 $0
现在不用这个 url 一切是正常的。。。
现在的 deploy

fis.match('{css/*.css,less/g.less,js/*.js,html/*.html,img/**,map.json}', {
  deploy: fis.plugin('local-deliver', {
    to: './publish',
    // url: './publish/$0',
  })
})

fis.media('test').match('{css/*.css,less/g.less,js/*.js,html/*.html,img/**,map.json}', {
  deploy: fis.plugin('http-push', {
    receiver: 'xx/receiver2.php',
    to: '/data/wapstatic/monkeytao/now'
  })
})

2 还是用 domain 的方式解决了相对路径的问题,因为:

fis.hook('relative');

fis.match('*', {
  relative: true,
})
[ERROR] Cannot read property 'query' of undefined in [/html/index.html]

3 没有搞清楚为啥我不这样

fis.set('project.ignore', [
  'save/{*,**/*}',
  //...
])

publish 下面就会有 save 文件夹
值得注意的是上面我的 publish.match 以及任何地方[默认文档中的默认参数]都没有 save 的呀
4 这个 deploy 和 release 的接口名字,很让人纠结,我的理解因为其实是 deploy要用到 release 的,

a: release 改为 deploypath 命令 releasedeploy
b: release 保留 deploy 改为 releaseaction 。。。

5 查了很多文档,发现 gulp grunt 都是考虑不支持把依赖装在全局的,理由是本地按需要维护,全局互相容易冲突。
fis 是全局的。
尝试了使用 NODE_PATH 添加 fis3 专用 node_modules ,但是报错找不到插件等。
是否考虑支持我这样用 NODE_PATH 共享依赖,不污染到全局,毕竟 fis 很多依赖和插件等都不是常用的 node 模块

from fis3.

oxUnd avatar oxUnd commented on May 30, 2024

先说 $0 是 match 的属性不是 deploy 的属性,你这块看差了。

关于 NODE_PATH 设置 FIS3 也是严格按照 NODE 的查找规则,这个你再看看。

之所以全局扫文件是因为 FIS3 是按照项目来处理的,而对扫描到的文件进行文件属性分配,这些属性决定了如何构建这个文件。详细请参考文档;

from fis3.

yolio2003 avatar yolio2003 commented on May 30, 2024

想要在 local-deliver 之前,清空 publish 目录,现在这样写了

// fis.match('*', {
fis.match('{less/**,html/**,img/**,js/**,map.json}', {
  deploy: [
    function(options, modified, total, next) {
      require('del')(['./publish/**'], function() { 
        next()
      })
    },
    fis.plugin('local-deliver', {
      to: './publish',
    }),
  ]
})

from fis3.

2betop avatar 2betop commented on May 30, 2024

赞!

from fis3.

yolio2003 avatar yolio2003 commented on May 30, 2024

赞 fis3, 虽然还有不少的意外,但是我们项目最基本的功能已经能用了,而且最终配置非常简洁

from fis3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.