Coder Social home page Coder Social logo

Comments (8)

oxUnd avatar oxUnd commented on May 30, 2024

tpl 已经纳入为 html 类文件,所以 html 的三种语言能力支持完善,不清楚你遇到了什么问题?

from fis3.

whq731 avatar whq731 commented on May 30, 2024
├─tpl
│  ├─product
│  │     product.tpl
│
└─hosts
    │  product.php
    ├─js
    │      product.js

product.php 加载product.tpl
tpl内引用js/product.js

这种目录结构通过什么配置可以解决吗?

from fis3.

oxUnd avatar oxUnd commented on May 30, 2024

@whq731 路径写错了,支持路径

相对路径 和 绝对路径(相对于项目根目录)

那么你在 product.tpl 中使用 product.js,应该这么写。

相对

<script src="../../hosts/js/product.js"></script>

绝对

<script src="/hosts/js/product.js"></script>

from fis3.

2betop avatar 2betop commented on May 30, 2024

@whq731 这个问题解决了吗?

from fis3.

whq731 avatar whq731 commented on May 30, 2024

恩解决了
想问下fis3 有类似gulp-rev-replace这个插件的功能吗?
我是用这个插件解决的

tpl里的引用写的相对路径
页面拼装时是加载tpl到php的页面里了
就是在Php里写src="js/product.js" 这样一样

from fis3.

oxUnd avatar oxUnd commented on May 30, 2024

@whq731 很不夸张的说,FIS 的路径替换是研究了几年以后出错率最低的方式。

from fis3.

animabear avatar animabear commented on May 30, 2024

@xiangshouding 你好,请教下模版文件中如何定位资源

tmpl文件(underscore模版)中使用图片,如何保证打包后添加cdn地址和图片md5

fis-config.js

fis.match( '*.tmpl', {
    rExt: '.js',
    parser: fis.plugin( 'undertpl' ),
    release: false
} );

test.tmpl:

<img src="/static/image/activity/dance/header.png">

test.js:

var TMPL = __inline('test.js');

期望的打包结果是:

<img src="//${domain}/${build.staticPublish}/static/image/activity/dance/header_90b7349.png">

请问该如何进行配置?

ps: 通过设置 isHtmlLike:true 后,tmpl文件被编译为了字符串,之前是一个函数

from fis3.

animabear avatar animabear commented on May 30, 2024

解决了,本质是js文件

<img src="<%= __uri('/static/image/activity/dance/header.png') %>">

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.