-
Notifications
You must be signed in to change notification settings - Fork 710
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
Subfolder in the project - using nude #460
Comments
Depends on your templating configuration, I'm not sure what you're using. You could try changing this in return gulp.src('app/*.html') to this: return gulp.src(['app/*.html', 'app/accessible/*.html']) or to include all HTML files except those in return gulp.src([
'app/**/*.html',
'!app/includes/**/*.html',
'!app/layouts/**/*.html'
]) |
My return gulp.src(['app/*.html', '.tmp/*.html']) then I change: return gulp.src([
'app/**/*.html',
'.tmp/**/*.html',
'!.tmp/includes/**/*.html',
'!.tmp/layouts/**/*.html',
'!app/includes/**/*.html',
'!app/layouts/**/*.html'
]) That's right, or have a simpler way to do? |
Hi @silvenon, I changed the
|
Same problem here: no browser refresh for .html in subfolders, even with |
@CesarDenis could you share the whole gulp.watch([
- 'app/*.html',
+ 'app/**/*.html',
'app/images/**/*',
'.tmp/fonts/**/*'
]).on('change', reload); However, some paths might break in nested HTML files, you should probably start convert them to |
@silvenon see my gulpfile.babel.js It seems that the error is in the plugin |
@CesarDenis only watch |
gulp.watch([
'.tmp/**/*.html',
'.tmp/scripts/**/*.js',
'app/images/**/*',
'.tmp/fonts/**/*'
]).on('change', reload); |
@silvenon, the error is in When the [09:15:08] Finished 'views' after 10 s
[09:15:08] Starting 'html'...
events.js:154
throw er; // Unhandled 'error' event
^
Error: Error: File not found with singular glob: /Users/macweb01/Sites/ccr/ras/styles/main.css
at DestroyableTransform.<anonymous> (/Users/macweb01/Sites/ccr/ras/node_modules/gulp-useref/lib/streamManager.js:90:36)
at emitOne (events.js:95:20)
at DestroyableTransform.emit (events.js:182:7)
at emitOne (events.js:90:13)
at DestroyableTransform.emit (events.js:182:7)
at Glob.<anonymous> (/Users/macweb01/Sites/ccr/ras/node_modules/gulp-useref/node_modules/glob-stream/index.js:38:16)
at Glob.g (events.js:273:16)
at emitOne (events.js:90:13)
at Glob.emit (events.js:182:7)
at Glob._finish (/Users/macweb01/Sites/ccr/ras/node_modules/gulp-useref/node_modules/glob-stream/node_modules/glob/glob.js:172:8)
at done (/Users/macweb01/Sites/ccr/ras/node_modules/gulp-useref/node_modules/glob-stream/node_modules/glob/glob.js:159:12)
at Glob._processSimple2 (/Users/macweb01/Sites/ccr/ras/node_modules/gulp-useref/node_modules/glob-stream/node_modules/glob/glob.js:652:12)
at /Users/macweb01/Sites/ccr/ras/node_modules/gulp-useref/node_modules/glob-stream/node_modules/glob/glob.js:640:10
at Glob._stat2 (/Users/macweb01/Sites/ccr/ras/node_modules/gulp-useref/node_modules/glob-stream/node_modules/glob/glob.js:736:12)
at lstatcb_ (/Users/macweb01/Sites/ccr/ras/node_modules/gulp-useref/node_modules/glob-stream/node_modules/glob/glob.js:728:12)
at RES (/Users/macweb01/Sites/ccr/ras/node_modules/inflight/inflight.js:23:14) It seems that the error is in the plugin .pipe($.useref({searchPath: ['.tmp', 'app', '.']})) To be able to generate the files necessary to change the layout: This: <!-- build:css ../styles/main.css -->
<link rel="stylesheet" href="../styles/main.css">
<!-- endbuild --> For this: <!-- build:css ../styles/main.css -->
<link rel="stylesheet" href="/app/styles/main.css">
<!-- endbuild --> |
I also have same problem. Do you have any solution regarding |
This change worked for me;
I use Jade btw. |
@rizqinizamil you can shorten code a little bit: return gulp.src(['app/*.html', '.tmp/**/*.html'])
.pipe($.useref({searchPath: ['.tmp', 'app', '.', '']})) |
@neilhem Yes, you are right. Thank you! |
Actually I still have a problem.
but got error Any idea? |
@rizqinizamil what is the difference between those two code blocks? |
@silvenon Oops, sorry, my fault. I write it with sleepy eyes :|. Please check, I just edited it. |
Ok, this seems to be a tricky problem. Correct me if I'm wrong, but the way I understand it is that if you have files at different directory levels extending the same layout with the same useref blocks, assets won't be served/built correctly because they are relative to the HTML files, which exist on different levels. Right? |
@silvenon Yes, you are right. |
This generator is meant more for single page apps, that's why it doesn't support nesting like this. I'll see what I can do, but it will take me some time. If you want, you can create a demo repo with this use case and link it here (let's use Nunjucks), so we can open PRs with our proposed solutions. |
I added mine with the following. Added this just below the extras script in the gulp file
Then changed this guy to add my copy script
Then I made sure all the directories in my subdirectory html linkage is correct and it seems to work for now. |
[EDIT] I'm dumb and didn't realize the build comments in html actually mattered. Here's how I got my subfolders to work in a basic webapp + nunjucks setup I followed the steps in the Nunjucks recipe linked from generator-webapp. I've done all the changes listed in that recipe first, and then I decided to try using subdirectories. Here's what I did in my gulpfile.js that's different from the recipe:
return gulp.src(['app/**/*.njk','!app/includes/**/*.njk','!app/layouts/**/*.njk'])
return gulp.src([
'app/**/*.html',
'.tmp/**/*.html',
'!.tmp/includes/**/*.html',
'!.tmp/layouts/**/*.html',
'!app/includes/**/*.html',
'!app/layouts/**/*.html'
])
<!-- build:css /styles/main.css -->
<link rel="stylesheet" href="/styles/main.css">
<!-- endbuild --> Now I can create additional child pages in subdirectories like @CesarDenis had in his first comment.
Thanks for the help in this thread! |
@dainbrain but your solution will not work if you need push your code to subfolder, am I right? |
The issue you're experiencing is likely related to how the build process is configured in your gulpfile.js for handling folders and files inside your webapp/app/accessible directory. The gulp task probably isn't configured to copy everything from your app directory (like the accessible folder and its files) into the dist folder when running the production build. Hereβs how you can ensure that the accessible folder and its contents are correctly handled during the build process. Update Gulp Task for HTML Files: Modify your existing html task to ensure it processes all html files, including those in the accessible folder. Add a glob pattern to ensure files from subdirectories are included. In your gulpfile.js, the task for handling HTML files may look something like this: js Include Static Files Task: You may need a separate task to copy over static files (e.g., non-HTML files) into the dist directory. Hereβs how you can do that: js Ensure Folder Creation: Make sure you have tasks that create the required folder structure. You can explicitly copy directories using Gulp like this: js js |
I need a little help π
In my project I need the following file structure:
When I run the command
gulp serve
, it works.But when I run
gulp
, the folderaccessible
is not created.Can someone help me?
Best regards. π
The text was updated successfully, but these errors were encountered: