Comments (20)
base on path of gulpfile
from gulp-file-include.
it SHOULD base on the path of file who use @@include
from gulp-file-include.
add a option dir.
from gulp-file-include.
@wiz-Cll please try v0.3.0 and give a feedback.
If everything is ok, close this issue.>_<
from gulp-file-include.
Can you explain how to use it? I still have problem with partials
from gulp-file-include.
is this example helpful?
from gulp-file-include.
not exactly, I am looking for solutions for my case klei/gulp-inject#33
from gulp-file-include.
Me too.
I'm trying to do multi-level nested includes. e.g. include a file that includes other files.
If possible, referencing the path of file who use @@include
will be helpful, or alternatively referencing the location of the gulp.js file would be fine.
Using @root
was promising but didn't help since it was referencing my node_modules/gulp-file-include
which lays outside of my project (is that normal?)
And giving an absolute path works fine for me but might break if I pass it to a developer with different path to the project.
from gulp-file-include.
gulp-file-include which lays outside of my project
haha, maybe is not normal, but I'll consider this.
And giving an absolute path works fine for me but might break if I pass it to a developer with different path to the project.
yes, absolute path
is not good.
about @file
, yes, seems some bugs, I'll fix it
from gulp-file-include.
actually, @file
is relate to the file pass to gulp stream.
from gulp-file-include.
@tsi , I think @file
all relate to the file pass to gulp stream is simple.
I'll fix the readme
from gulp-file-include.
from gulp-file-include.
Yes, your example describes (but not solving) my problem very well:
All include paths are relative to index.html
, even those called from the inner partials (e.g. a1.html
).
Now, in my forked example I have a second page at a sub directory - /pages/somepage.html
I am able to call a1.html
from page.html
since I changed the path from a/a1/a1.html
to ../a/a1/a1.html
but the process will fail since a1.html
includes a2.html
using a path relative to index.html
.
The best solution I can think of is allowing paths to be relative to gulp.js which is constant and can be referenced from anywhere safely.
Thanks!
from gulp-file-include.
@coderhaoxin did you see this? I realize this issue is closed, should I open a new one?
from gulp-file-include.
I think I know what the problem is.
The basepath is only set for the first file that is included.
So all further inclusions are relative to it, even if it in turn includes new files.
Imagine this structure:
|--file1.html
|--folder1
|--file2.html
|--folder2
|--file3.html
Scenario: File1 includes File2 and File2 includes File3.
Now when I chose @file as the basepath what I expect would be this:
File1: @@include('folder1/file2.html')
File2: @@include('folder2/file3.html')
However this does not work because the plugin is looking for folder 2 in the same level as file1, because this was the first one to be included and thus set the basepath.
The only way it does work is like this:
File1: @@include('folder1/file2.html')
File2: @@include('folder1/folder2/file3.html')
Because files, especially when using relative paths, should be agnostic to which file includes them I think this is clearly a bug.
I will have a look at the source and see if I can figure out a quick fix.
from gulp-file-include.
@janpaepke yes, you're right.
But that will broken.
from gulp-file-include.
@janpaepke pr welcome. Just need a big version.
from gulp-file-include.
I made some changes and it works as expected for my usecase now.
It does fail one test though and I don't have more time to look into it.
But I guess it's a starting point...
from gulp-file-include.
glad I could help :)
from gulp-file-include.
π thanks
from gulp-file-include.
Related Issues (20)
- Postfix
- Support recursive include? HOT 1
- Multiline in variable and json error HOT 1
- Can I use different styles for different source filesοΌ
- More error info
- How to loop array of objects if it is inside array of objects in the same JSON file?
- could i config custom `@@webRoot` or add `@@urlRoot` ? HOT 6
- Filters documentation
- Is not difined in IF statement HOT 2
- Question: Extension support in vscode
- Include with part of the JSON HOT 1
- nested for loop, inner variable is not defined HOT 1
- Can html page files be generated in batches? HOT 1
- @@webRoot documentation HOT 4
- Invalid character error HOT 1
- Build only the files that will be changed
- Detect which file have an error
- Fix : invalid characters in JSON5 HOT 2
- json not work in loop HOT 1
- Pass variables to child include
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gulp-file-include.