GithubHelp home page GithubHelp logo

krasimir / techy Goto Github PK

View Code? Open in Web Editor NEW
249.0 249.0 23.0 3.96 MB

A flat file CMS based on Gulp and AbsurdJS

Home Page: http://krasimir.github.io/techy

License: MIT License

JavaScript 9.39% CSS 87.83% HTML 2.78%

techy's People

Contributors

gizm0bill avatar kalkov avatar simonewebdesign avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

techy's Issues

Unable to set custom source directory for MD pages

I think I may have found a bug with the CLI usage. On two separate computers (Windows 8.1 and 10), I cannot get version 1.2.4 to use anything other than the current directory as it's "source" folder.

The command I'm running is techy --src ./_pages, but regardless of my current folder structure, it always runs from the folder where I'm running the command. I can confirm this because the README.md file in my project root is also being converted to .html.

I discovered in a comment on #20 that this CLI parameter usage was added in 1.0.0, so I installed that version specifically to test and the issue doesn't exist there. This must have been something that went wrong since then. I should note here that the --dest parameter works correctly; the output definitely goes to the folder I specify. I can't confirm the --theme parameter though, since 1.2.4 doesn't seem to generate any themes folder as I see version 1.0.0 doing.

Unfortunately I can't find a list of releases, so I haven't been able to work out which specific release these issues in.. Please let me know if you need help with debugging this further.

Edit: I found a list of the versions using npm view, I'll see if I can work out which version broke this functionality and leave a comment if I find anything useful.

Templates don't have access to Techy functions

F.e. using the following template _tpl/partials/latestArticles.html

<% set('articles', list()) %>
<% if (get('articles')[0]) { template('partials/pagelink', { name: get('articles')[0].get('name') })} %>
<% if (get('articles')[1]) { template('partials/pagelink', { name: get('articles')[1].get('name') })} %>
<% if (get('articles')[2]) { template('partials/pagelink', { name: get('articles')[2].get('name') })} %>
<% if (get('articles')[3]) { template('partials/pagelink', { name: get('articles')[3].get('name') })} %>

Importing this into my layout.html using the template() call results in a 'set is not defined' error. Same goes for get.

Is this intended?

autoapdating "processed" files

If a partial or preface property is updated techy needs to be restarted to render the changes into html. It would be great to not have to come through that step

Step by step tutorial

Do you have a tutorial or at least an example of a simple site where some .md file is injected (as a sidebar/footer)?

Improvement on CSS watch

I actually had the requirement to compile a style that included others, but trigger it when others changed as well. So I figured I could do change the compileCSS function with this:

CSSDirToWatch = api.config.css.watch || index;

and have a config entry like this:

module.exports = function() {
    return {
        css:  {
            preprocessor: 'less',
            index: '_styles/less/style.less',
            out: '_dist/public/css',
            watch: '_styles/less/**/*.less'
        }
    }
}

to achieve that.

Techy not working

I use techy for a college website and generate the site every day. It suddenly stopped working. I tried it in a more reliable dev environment, and the same problem happened. It hangs and none of the folders generate. This comes from a setup where it has been used for years. Suddenly, it's broken. The last successfully generation was in late April. Any idea?

Nevermind. There was an issue that actually has nothing to do with Techy. There was 17mb worth of base64 encoded media on a page, so Techy was taking nightmarishly long to process that file.

CLOSED

Add favicon support

The <link rel="shortcut icon" type="image/png" href="favicon.png" /> thing

Doesn't compile "classic" CSS files

Hi,

I'm trying Techy and I wish not to use AbsurdJS for my CSS : I jus't liked to use classic CSS or LESS/Sass CSS.

But it seem that Techy only compiles .js CSS files, is it ?

Would it be possible to compile .css or even .less or .scss ?

Have a nice day,

RaphaΓ«l

Is this project active?

Hi all.

I want to help, but I want to know if this project is active. Is this project active?

Draft functionality

It would be good to have a draft pages
These would live, be rendered, but not returned via this.pages(...)

Default theme configuration

Is there a way to set the default layout? I'd rather not have to rely on myself typing <% set('layout', 'layouts/layout.html') %> at the beginning of every file.

(I may be missing something here, I wasn't 100% on this part of the documentation)

Change default output folder name to dist

By default, techy now generates a dest folder for generated files. This is confusing because the convention is to call this kind of folder dist. I would suggest this:

  • --dest the parameter that Techy takes, it is short for destination. Keep this the way it is.
  • dist the folder where Techy puts the generated files by default, it is short for distribution. So my advice would be to change the default folder name from dest to dist.

A small change, but it makes more sense that way. Other projects do it like this as well, for example Yeoman, IDE's like Netbeans and several gulp plugins.

An ability to add images to preface

I tried simply adding the tag, butthen it fails in tag pages.
I could start path with /, but then it will not work on local machine.
Maybe it would be good to start a server on localhost while techy is running?

More Gulp-like?

Despite being based on Gulp, Techy has a Grunt-like feel. You run "techy" and it reads a Techyfile for some configuration and then processes the files. I don't like the fact that Techy puts the resulting files next to the source files (I prefer that the generated files go into another directory that can be easily placed in .gitignore and rsync'ed to my server). But, since Techy is a command and not something that can process streams (in Gulp fashion), it's less than clear how I'd specify a destination.

It seems like what Techy is really offering is the merging of content with layouts. What if that could be done stream-style? Then, I could create a Gulpfile that processes my source files in any way I choose (any way that is supported by any of the Gulp plugins) and put the destination files anywhere I choose.

That may not at all be what you want Techy to be, and the authors of Gulp seemed to even support the notion that people will build Grunt-like tools on top of Gulp, but I thought I'd put forth the idea and see what you thought.

Super simple (gulp) usage?

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!]

Techy not picking up dest parameter from TechyFile.js for public folder

The new commands src and dest are working fine when you use them from the command line, but when src and dest are defined in a theme's TechyFile.js they don't work as expected.

For example, with this TechyFile.js:

module.exports = function() {
    return {
        src: './input',
        dest: './output'
    }
}

Techy grabs the markdown files correctly from the input folder and it outputs the .html files in output. The bug is that it puts the .js and .css in a dest/public folder when it should be output/public. So it seems that Techy is not using the dest parameter for the .js and .css files.

Pages() usage?

I'm a little confused on the usage of the pages() function. I've read the documentation and tried a couple tests, but I can't seem to understand what the use of it is. Unless I'm mistaken, it doesn't appear Techy has any way of accessing the data in the array pages() returns. I know with page(), you can get data from it using the get() function. However with pages(), if you use get(), how will you know what index you are getting data from? Is there some feature I'm missing that would allow me to access the data?

For the project I'm working on, I was hoping I could get the data from pages and loop through it to create a nav menu. Is something like this possible with Techy?

EDIT: after doing a few more tests, it seems get() doesn't work with pages(). Page() works just fine, but pages() errors out.

Here is the code I tested it with:
<% page('Header').get('temp') %> -- Works just fine
<% pages().get('temp') %> -- errors

Blog layout?

Thanks for helping out with my last issue... is there an easy way to have a blog layout? As in a page either with posts vertically arranged (markdown files being imported as posts in a container) or with links to all the posts?

Separate the gulp plugin

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.

Setting src and dest to same path == Misery

I tried using the same path for --src and --dest to get side-by-side rendering. It created a path so long in Windows I spent half an hour figuring out how to delete the files.

": No such file or directory" error after install

I ran the command

npm install -g techy

but once installed without errors, it fails to run even with a .md file in the folder. It returns:

: No such file or directory

Is there a global dependency that I need to upgrade or something? Or was this designed for a specific environment like MacOS?

"which techy" returns /home/USER/local/bin/techy, which is where all my global node cli's reside. Other cli's run without issue.

I'm running Ubuntu 13.04, Node v0.10.20 installed via NVM

Sass (.scss) with techy

I'm planning on using sass with my techy project, but after following the exact steps in your documentation, techy does not seem to be compiling the .scss files. This is what I've done:

  • I've of course installed techy with npm install techy -g, and I've installed the sass ruby gem and gulp-sass (globally)
  • In my techy projects' themes/empty/sass folder I have a styles.scss file (which contains some basic, valid css rules)
  • I have a TechyFile.js file in the root of my techy project, which contains:
module.exports = function() {
  return {
    css: {
      preprocessor: 'sass',
      index: 'sass/*.scss'
    }
  }
}

Now when I'm running techy with techy --theme empty it says that the css has been compiled, but nothing appears in the themes/empty/public folder. Is there something I've missed or is this a bug in techy?

Using as Gulp plugin throws TypeError and packing error

Hi,

I'm not sure if the following error is related to Techy or if my implementation is faulty, but I've been unable to resolve the following issue on my own. If you need more info or require more info about my implementation please message me back. If necessary I'll add you as a contributor to my project so you can look at the source code.

The error:

TypeError: cb is not a function
    at Object.compileCSS (E:\Git\fsv-csi\node_modules\techy\lib\index.js:232:5)
    at E:\Git\fsv-csi\node_modules\techy\lib\index.js:301:12
    at Gulp.gulp.task (E:\Git\fsv-csi\gulpfile.js:179:15)
    at module.exports (E:\Git\fsv-csi\node_modules\orchestrator\lib\runTask.js:34:7)
    at Gulp.Orchestrator._runTask (E:\Git\fsv-csi\node_modules\orchestrator\index.js:273:3)
    at Gulp.Orchestrator._runStep (E:\Git\fsv-csi\node_modules\orchestrator\index.js:214:10)
    at Gulp.Orchestrator.start (E:\Git\fsv-csi\node_modules\orchestrator\index.js:134:8)
    at E:\Git\fsv-csi\node_modules\gulp\bin\gulp.js:129:20
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)
    at Module.runMain (module.js:607:11)
    at run (bootstrap_node.js:422:7)
    at startup (bootstrap_node.js:143:9)
    at bootstrap_node.js:537:3
Error packing Error: Techy: I can't copy E:\Git\fsv-csi\bin folder!
    at E:\Git\fsv-csi\node_modules\techy\lib\index.js:154:18
    at cb (E:\Git\fsv-csi\node_modules\ncp\lib\ncp.js:224:23)
    at onError (E:\Git\fsv-csi\node_modules\ncp\lib\ncp.js:216:12)
    at E:\Git\fsv-csi\node_modules\ncp\lib\ncp.js:134:16
    at FSReqWrap.oncomplete (fs.js:114:15)

The Gulp implementation:

techy = require('techy').gulp(); // For databaseless blogging.

/**
 * Compile all blogs from Markdown to HTML.
 */
gulp.task('blog', () => {
    const blogSrcPath = CONFIG.SOURCE_ROOT + "/" + CONFIG.BLOG_DIR_NAME + '/articles/**/*.md';
    const blogDestPath = CONFIG.DEST_ROOT + '/' + CONFIG.BLOG_DIR_NAME;

    gulp.src(blogSrcPath)
        .pipe(techy())
        .pipe(gulp.dest(blogDestPath));
});

...
gulp.watch(CONFIG.SOURCE_ROOT + "/**/*.md", ['blog']);  // Watch and compile Markdown blog
...

Empty SCSS files cause node to crash and burn

I get a "node quit unexpectedly" and errors with empty SCSS files - should be an easy fix, just tell it to ignore empty files probably. Outputs:

+ CSS compiled
+ Pages compiled
Techy is listening for changes!
+ CSS compiled
Assertion failed: (val->IsString()), function _NanGetExternalParts, file ../node_modules/nan/nan.h, line 1725.
fish: Job 1, 'techy' terminated by signal SIGABRT (Abort)

Do we really need themes?

When using techy I personally feel that the themes aren't needed and only add complexity. I've never switched themes during a project and always just develop with a single theme.

To me it makes more sense to remove the themes option from techy. It feels a bit like a wordpress remnant. For wordpress users themes make sense, since a wordpress network install can manage multiple sites at once and you would need multiple themes. But a single techy project does not have to manage multiple sites at once and on one website you can only use one theme at a time.

  • if I want a new design I can redesign the current theme (or style)
  • if I want a new website I can just create a new techy project (in a new folder)
  • even without the themes option you still have templates, partials and all the possibilities css has to offer, which is more than enough for one websites styling needs
  • even without the themes option it still would be just as easy to copy styles from one techy project to another

Jekyll for example, which is very similar to Techy and used by Github pages, doesn't use themes and it is one of the most popular flat file cmses.

I think Techy would be easier to understand, easier to use and easier to maintain without the themes option, and that it wouldn't harm the functionality of techy. In fact, I think techy would become easier to use since there would be less configuration required.

Separation between source files and generated files

Right now there is not really a clean separation between the source files and the generated files with Techy. The generated .html files are put in the root and in subfolders, and the .css and .js is put in the public folder of the selected theme.

I understand the advantages of this, but a more common practice is to place all generated files in one single location, and separate them from the source files (such as the templates, markdown, etc.). For example: Yeoman puts all generated files in a dist folder in the root, Jekyll puts them all in a _site folder.

This allows for easier distribution and watch tasks (just watch and ftp one single folder to the live server), easier version control (just gitignore the folder with the generated files) and makes it clear to the user which files are generated and which are source.

What do you think? Techy could have a themes and a dist folder for example. It is a pretty common practice and would make things a little easier in my opinion.

Automatically minifying css, html and js final files from _dist

How and where could I add a script/function that automatically minifies the final files of the directory /_dist every time something changes there? (i.e. while "techy is listening"). Thanks πŸ™πŸ½

(I know it's kind of a broad question, but let's say is a way to start the discussion at least πŸ˜…)

RSS generation

I was just looking again at the Techy documentation and it's not clear to me what the "right" way to generate an RSS feed would be. It's a different file type than the others Techy is used to working with...

Support YAML frontmatter

I'm in the process of converting one of my sites (with a blog) from WordPress to a static site generator. I'm using Hugo now (Hugo is much faster than any other generator I've seen), but I think Techy has promise. Gulp can run pretty quickly, and I'm a JavaScript person so there would be some convenience for me in being able to customize the behavior.

Jekyll, Hugo and others support YAML frontmatter for adding variables related to a page. It looks like this:

title: My Cool Title
categories:
    - Stuff

---

## My content follows
...

This is something of a standard, and a flexible one at that. It's more convenient than <% set("title", "My Cool Title") %>, especially given that my files already have the frontmatter. Plus, when going from WordPress to one of these formats, there are already converters that generate this sort of output.

One approach would be to create a converter to convert the frontmatter to set() calls, but I think it would be cleaner to support the frontmatter directly and leave the files in that format.

Minifying SCSS

Techy does not appear to minify SCSS files after compilation. Is there a way to do this?

--src path still exists in --dest output

My structure looks like this:

/site
  /_pages
    /index.md
  /public

and when I run techy --src ./_pages I get:

/site
  /_pages
    /index.md
  /_dist
    /_pages
    /index.html
  /public

Why does the --src _pages folder still exist in the --dest output? Am I doing something wrong or has the output behavior changed since the docs?

code prettifying with prism.js?

I was planning on adding prism.js to my template and then wrap my code samples with ~~~ .language-coffeescript to generate <code class='language-coffeescript'> but Techy is generating <code class='lang-.language-coffeescript'> - not quite sure where the extra lang- is coming from.

Then I noticed in the default theme prism.css and prism.js exist, does this mean you have already got prettified code snippets written in markdown, if so, what is the markdown syntax you are using?

Modular content

Hello there!

Do you see any way I could create pages with modular content using Techy?

E.g. using <% get('content_1') %> and <% get('content_2') %>

Love Techy! Thanks for sharing!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.