Skip to content
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

Child Pages #6

Open
eikeco opened this issue Jul 2, 2014 · 15 comments
Open

Child Pages #6

eikeco opened this issue Jul 2, 2014 · 15 comments

Comments

@eikeco
Copy link

eikeco commented Jul 2, 2014

Original ticket on the assemble.io repo.
assemble/assemble#537 (comment)

Is there a way to set up child pages with gulp-assemble?
For example example.com/parent/child.html.

Looks like you can use "flatten" (https://github.com/assemble/assemble#flatten) in Grunt. Any idea if it's possible with gulp?

@jonschlinkert
Copy link
Member

Looks like you can use "flatten"

I don't think so. But like I mentioned https://github.com/jonschlinkert/gulp-rte might be a good solution here. I know it's one more plugin, but that's the gulp way (just adding mention of this here in case others read here)

@eikeco
Copy link
Author

eikeco commented Jul 2, 2014

Thanks @jonschlinkert. I will give it a go and post any results here.

Thanks again :)

@dtothefp
Copy link

@jonschlinkert @eikeco any progress on this issue. I've been working a lot on our company website in grunt-assemble and playing around with switching over to Gulp. Seems like multiple gulp.dest is an issue for many plugins. I tried to hack it in the task but resulted in some double compilation and it's not ideal. I'm willing to help on this issue if it's still something you guys are working on.

var glob = require('glob');

  glob('src/pages/**/*.hbs', function(err, files) {

    files.forEach(function(filePath) {
      replacedPath = filePath.replace('src/pages/', '');

      if ( /\//.test(replacedPath) ) {
        buildPath = replacedPath.substr(0, replacedPath.lastIndexOf('/')) - 1;
      } else {
        buildPath = '';
      }

      gulp.src(filePath)
        .pipe(assemble(options))
        .pipe(gulp.dest('build/' + buildPath));
    });
  });

The result of the above will be a duplication of the index file inside of the nested directory and it's content is the HTML templated twice.

screen shot 2014-08-11 at 1 47 26 am

@dtothefp
Copy link

@jonschlinkert @eikeco anybody out there...Bueller??

@jonschlinkert
Copy link
Member

@dtothefp thanks for the ping! I read this initially on my iphone and forgot to respond when I got to my computer.

I'm willing to help on this issue if it's still something you guys are working on.

yeah, I'd love to hear your thoughts on what the solution might look like. one idea I've considered is creating a plugin that can be used as an alternative to gulp.dest().

just to make sure I'm clear on what you need, you just want to build to multiple destinations using the same src files and task configuration. is that all or are there other things you need to accomplish?

@jonschlinkert
Copy link
Member

... and sorry it took so long to reply!

@dtothefp
Copy link

@jonschlinkert yes, all I'm looking to do is build multiple destinations using the same src files, without having to build multiple tasks. Also the directory structure of the build tree should match that of the source files. This is so easy in Grunt, but due to the streaming nature of Gulp it seems to be a ubiquitous problem.

Something along the lines of this might be appropriate

gulpjs/gulp#372 (comment)

Creating an object of all paths, passing them through gulp.src and manipulating their paths with gulp-tap

PS I'm working with @kylerush at Optimizely implementing Assemble for our new marketing website. We are using the Grunt version heavily now but I wanted to play around with what you guys have in Gulp so far

@jonschlinkert
Copy link
Member

PS I'm working with @kylerush at Optimizely implementing Assemble for our new marketing website. We are using the Grunt version heavily now but I wanted to play around with what you guys have in Gulp so far

Awesome! let us know how we can help. fwiw, if you want to play around with the gulp version, I highly recommend taking a look at assemble v0.6.0 instead - it depends on some of the awesome libs from the fractal team. it's nowhere near production ready, but it's orders of magnitude more powerful (and IMHO, easier to use) than Assemble 0.4.x. Not to mention, although the built-in plugins we're using currently take about 1 second to spin up, after that it's screaming fast. also fwiw, we will be externalizing those plugins, engines, parsers etc. into their own repos - and promoting use of gulp plugins whenever possible. @doowb did some benchmarking with thousands of files that we'll share when we launch.

btw, just out of curiosity where is optimizely located?

@eikeco
Copy link
Author

eikeco commented Oct 9, 2014

@dtothefp did you manage to get any further with this? I have a number of times but can't get my head around it...

@dtothefp
Copy link

dtothefp commented Nov 8, 2014

@eikeco sorry I forgot to get back to you. I actually did have time to continue with Gulp Assemble but I did actually just start looking at their v0.6.0 API and CLI. Looks like this would do a lot of what we desire for the multiple destinations, and you could probably just fire up the CLi with Gulp if you wanted. I just sent a message to @jonschlinkert for some example repos as I'd like to start playing around with this.

Alternatively, if you still want to try the gulp-assemble route a friend of mine suggested this structure for mulitple dest in gulp http://jsfiddle.net/d4q5h66x/. It's a browserify example but may be pertinent.

@kluplau
Copy link

kluplau commented Sep 14, 2015

Hey @jonschlinkert, any news on this...?

@dtothefp
Copy link

@BlueBlau if you want to use gulp, just use assemble v0.6 directly inside of your gulp task. Have a look at my assemble docs if you're not familiar with v0.6 https://github.com/dtothefp/assemble-docs

@jonschlinkert
Copy link
Member

@dtothefp that's awesome! can I use some snippets from those docs?! of course I'll give you attribution in our docs

@jonschlinkert
Copy link
Member

@BlueBlau this is something that can be done with a plugin. hmm... I have an idea. let me talk to @doowb

@kluplau
Copy link

kluplau commented Sep 14, 2015

Great. Thanks guys! :-)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants