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

Cannot compile a nested tag #99

Open
stnight opened this issue Nov 15, 2016 · 3 comments
Open

Cannot compile a nested tag #99

stnight opened this issue Nov 15, 2016 · 3 comments

Comments

@stnight
Copy link

stnight commented Nov 15, 2016

I tested to compile a nested tag that goes like this:

<story>
    <post></post>
    <comments></comments>
</story>

But i think base from the gulp-riot's capability it doesn't support it.

@e-jigsaw
Copy link
Owner

@stnight I used to like below

gulp.src(paths) // like ['components/story.tag', 'components/post.tag'..., 'index.js']
  .pipe(riot(...))
  .pipe(concat('index.js')) // gulp-concat
  .pipe(gulp.dest)

and index.js is just riot.mount('*')

It is might be works.

Thanks

@stnight
Copy link
Author

stnight commented Nov 25, 2016

@e-jigsaw your method doesn't work :(

@nonsensecreativity
Copy link

@stnight First you need to concatenating all of the tag files into one single tag file, here is example gulp tasks


const del = require( 'del' );
const gulp = require( 'gulp' );
const riot = require('gulp-riot');
const concat = require('gulp-concat');
const tagPath = './src/tags';
const jsPath = './src/js';
const bundleName = 'bundle'; // the file name for concatenating all tag file
const tagBundle = `${tagPath}/${bundleName}.tag`;
conse jsBundle = `${jsPath}/${bundleName}.js`;


/**
 * GULP RIOT TASKS
 */

// Remove Previous Bundled tag file and compiled js file
gulp.task( 'riot:clean', () =>
	del( [ jsBundle, tagBundle ] )
);

// Combine all tag files into one single tag file and put it in the ./src/tags/ directory
gulp.task( 'riot:concat', [ 'riot:clean' ], () =>
    gulp.src( [ `${tagPath}/**/*.tag` ] )
        .pipe( concat( `${bundleName}.tag`  ) )
	.pipe( gulp.dest( tagPath ) )
);

// Compile the concatenated tag file which is ./src/tags/bundle.tag
gulp.task( 'riot', [ 'riot:concat' ], () =>
    gulp.src( [ tagBundle ] )
        .pipe(riot())
	.pipe( gulp.dest( jsPath ) )
);

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

3 participants