-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
could i config custom @@webRoot
or add @@urlRoot
?
#183
Comments
A web page's URL is dependent on where the page is deployed and how the web server is configured, so the full URL is generally not known when the HTML is generated. An example use case might help clarify what you're trying to accomplish. If you actually know the URL ahead of time, you could just create a regular variable named |
@dpilafian i wanna configuration that global var ex)
|
You should be able to do that by setting the <!DOCTYPE html>
<html>
<body>
@@include("./var.html", { "some": "https://example.com/path" })
</body>
</html> |
@dpilafian |
Here's a real example that I think does what you're asking to do. It reads package.json into an object and then passes that into the gulpfile.js import { readFileSync } from 'fs';
...
const pkg = JSON.parse(readFileSync('./package.json'));
...
const webContext = {
pkg: pkg,
released: released,
minorVersion: minorVersion,
gzipSize: '8 kb gzip',
title: pkg.description, //default page title
youTube: linkInfo.youTube,
jsFiddle: linkInfo.jsFiddle
};
...
gulp.src(['website/static/**/*.html', 'website/root/**/*.html'])
.pipe(fileInclude({ basepath: '@root', indent: true, context: webContext })) Now you have access from the templates to everything in package.json. See the full file at: |
@dpilafian |
I want to use @@urlRoot (current there's no exist in this package)
Or
custom
@@webRoot
path.is it possible?
The text was updated successfully, but these errors were encountered: