krasimir / techy

A flat file CMS based on Gulp and AbsurdJS
http://krasimir.github.io/techy
MIT License
250 stars 23 forks source link

Super simple (gulp) usage? #29

Open gavJackson opened 10 years ago

gavJackson commented 10 years ago

I think Techy is a cool idea but there seem to be too many features that rely on specific directory structures (ie all the underscore prefixed dirs). The core features that appeal to me are the markdown to html conversion with the templating and variables. The other stuff like theming and copying are overkill for what I am doing and i think are making my project incompatible with Techy.

Is there a way to configure Techy to work with this structure:

/
/src/htdocs/index.md
/src/htdocs/api/other-page.md
/templates/article-template.html

and for it to spit out html files (using the article-template.html) right next to the existing md files? like this:

/
/src/htdocs/index.md
/src/htdocs/index.html
/src/htdocs/api/other-page.md
/src/htdocs/api/other-page.html

I have other gulp tasks that then copy src into a build folder and i could probably work out a way of stripping the md files out, or if that is not possible could Techy spit my files into my build folder for me, resulting in

/build/index.html
/build/api/other-page.html

My gulp task currently looks like this:

var gulp = require('gulp');
var Techy = require('techy').gulp({
    dest: './build',
    src: './src'
});

gulp.task('techy', function() {
    gulp.src('./src/htdocs/**/*.md')
        .pipe(Techy())
        .pipe(gulp.dest('./build'));
});

but it spits out this error:

Error packing [Error: Techy: I can't copy /Users/gavinjackson/Work/Digital Keystone/Website 2014/Source/htdocs folder! to Error: ENOENT, lstat '/Users/gavinjackson/Work/Digital Keystone/Website 2014/Source/htdocs']

tbh I haven't been able to get Techy to work even when I try the as-gulp-plugin example i get similar errors to the above

Error packing [Error: Techy: I can't copy /Users/gavinjackson/Work/Open Source/techy/example/as-gulp-plugin/dest folder!]

krasimir commented 10 years ago

Hello,

from a technical point of view it will be difficult to change the way Techy works with the files. I'll think more about that in the next few days. Maybe extracting only the feature that you need in an external module.

gavJackson commented 10 years ago

As an intermin step I have been able to use Techy through node.js (command line techy --dest 'temp' ) so it listens for changes across my project and compiles my markdown with my templates into html into a temp directory and then i manually copy the output file back into my src folder. At least this way I can use the cool templating features and continue to write my articles in markdown and use Techy to output the html I want.

It would be great if you could extract the markdown and templating parts of Techy, i think it would appeal to a wider audience of developers if it was a smaller Gulp task that can easily be integrated into existing Gulp builds.

krasimir commented 10 years ago

I agree. By the way, there is also a way to run Techy in a Node.js script - http://krasimir.github.io/techy/docs/#using-techy-in-node-js-script

var Techy = require('techy');
Techy(__dirname + '/docs', function() {
    this.watchFiles();
}, { myprop: 'my value' });