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

Separate the gulp plugin #8

Open
dangoor opened this issue Apr 16, 2014 · 7 comments
Open

Separate the gulp plugin #8

dangoor opened this issue Apr 16, 2014 · 7 comments

Comments

@dangoor
Copy link

dangoor commented Apr 16, 2014

Depending on techy right now requires gulp-absurd, gulp-sass, gulp-less, etc. A bunch of stuff that I don't use (and gulp-sass even requires native code).

If possible, it would be nice to break the new Gulp plugin out into techy-gulp (or gulp-techy) so that people using Gulp can just depend on the Gulp plugins needed for their projects.

@krasimir
Copy link
Owner

You are right. gulp-sass and gulp-less are required only if you need to use another CSS preprocessor. However, there are part of Techy's features list and we have to be careful by removing them. I'm thinking about moving gulp-sass and gulp-less out of the dependencies' list and if someone want to use them will promp a message saying that they should be added to the package.json file.

@dangoor
Copy link
Author

dangoor commented Apr 16, 2014

I may dig in to the code and make a more specific proposal (or possibly a pull request). I really like the way Techy feels as a Gulp plugin, and I think there's another step to take there, but I'm not 100% clear on it yet.

@krasimir
Copy link
Owner

Yep, it looks like using Techy as gulp plugin is better then the Techy's CLI. I'll spend some time concepting.

@dangoor
Copy link
Author

dangoor commented Apr 16, 2014

One problem that I encountered while playing with Techy last night was that my files were named *.markdown, whereas Techy was expecting *.md. It was no big deal for me to rename my files, but another way to look at it is that in standard Gulp style, I could select whatever set of files I want and then run them through a Markdown processor.

Here's what I'm thinking... there's a Gulp plugin for reading front matter, another for generating RSS, one for processing Markdown, etc.

I see Techy offering a couple of things:

  1. Connection between content and templates (I like the <% get('content') %> and the ability to define custom functions that can go into templates)
  2. an all-in-one static site generator

For people like me who want the flexibility of Gulp (I choose which files run through which processors), that first feature above is valuable. For people who want something that "just works", the second one (something like the current "techy" command) may be nice.

There are Gulp plugins for rendering various kinds of templates, but I'm not sure that they're as well tuned to the static site generation case as Techy.

@krasimir
Copy link
Owner

Sounds good. To simplify the things - the Techy's Gulp plugin should contain only the core functionalities. I.e. the API methods. The Markdown, CSS or JavaScript processing should be left for the techy command and the original Techy module.

I could say that this will make Techy much more flexible tool and will bring new possibilities. However I should make some big changes because the current code is oriented to the Markdown conversion. I think that we should keep most of the logic in the original repository and just provide a proper API for that new Gulp plugin. It will be better for the future development.

@mathroc
Copy link

mathroc commented May 29, 2014

I started using techy on a small project and I too think the gulp plugin is great. as far as i know it's the only way to run techy in a deploy process; the techy command does not seems to have a "stop when you're done" option. and that's fine since the gulp plugin exists

however, I think the plugin should focus on the markdown/template processing. CSS & js is handle very well with other plugins, so there's no needs to have it in gulp-techy (it's fine in the techy command)

in particular, here is a few things I think techy-gulp should not do:

  • create _css, _js and _tpl folder if they don"t exists
  • compile and copy files from _css & _js
  • run the techy command (without watch)

here is my use case, I have this folder structure:

src/
├── index.md
├── article/
│   ├── about-something.md
│   └── about-something-else.md
├── about.md
├── contact.md
www/
layout/
└── basic.html

I want gulp-techy to do one thing: compile the .md files present in src/ and put the result in www/

I'd like to do this using this gulpfile.js:

var gulp = require('gulp');
var techy = require('techy');

gulp.task('techy', function() {
    gulp.src('./src/**/*.md')
        .pipe(techy({
            template: 'layout/basic.html'
        }))
        .pipe(gulp.dest('./www'));
});

gulp.task('default', ['techy']);

and here is the one I end up having

var gulp = require('gulp');
var techy = require('techy').gulp({
    root: __dirname+'/techy',
    dest: __dirname+'/techy/dest',
    theme: 'default'
});

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

gulp.task('default', ['techy']);

that's not much difference but i have to add a /techy folder at the project root to hold the _css, _js, _tpl, dest & public folder created and/or needed by techy, ideally only the _tpl would be needed and - as in the first gulpfile.js - could be anywhere

what do you guys think about it?

@krasimir
Copy link
Owner

I agree with your points and will probably make Techy working as you described.

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