krasimir / techy

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

Doesn't compile "classic" CSS files #2

Open raphaelgoetter opened 10 years ago

raphaelgoetter commented 10 years ago

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

krasimir commented 10 years ago

This sounds like an awesome idea. I'll try to spend some time today integrating LESS, SASS and plain CSS.

krasimir commented 10 years ago

It's done. Now Techy supports plain CSS, LESS, SASS and AbsurdJS. The full documentation about this change could be found here http://krasimir.github.io/techy/docs/#css

Shortly: you have to add Techy.js file in the main project's directory with something like that:

module.exports = function() {
    return {
        css: {
            preprocessor: 'sass',
            index: 'sass/*.scss'
        }
    }
}

The compiled file goes to the public directory of the used theme.

I'll recommend checking the test cases: Absurd, SASS, LESS, Plain CSS.

P.S. The latest version of Techy that you should have to use the above is 0.0.21.

raphaelgoetter commented 10 years ago

Wow, that was fast. Thank You !

krasimir commented 10 years ago

You are welcome.

raphaelgoetter commented 10 years ago

After my Techy update, I still don't manage to compile plain CSS.

Here's what I did :

1- created a Techy.js file in my /themes/default with this content :

module.exports = function() {
    return {
        css: {
            preprocessor: 'none',
            index: 'css/styles.css'
        }
    }
}

2- changed css/styles.js to css/styles.css with plain CSS 3- lanched a techy: everything seems OK but no styles.css is compiled in my public folder.

What did I miss ?

krasimir commented 10 years ago

The Techy.js file should be placed in the main project's folder. I.e. the place where you run the techy command. For example:

project
    themes
        default
            css
                a.css
                b.css
            js
            public
                styles.css
            tpl
    Techy.js
    page.md

If you use the above file structure then the content of the Techy.js should be:

module.exports = function() {
    return {
        css: {
            preprocessor: 'none',
            index: 'themes/default/css/*.css'
        }
    }
}

themes/default/public/styles.css contains the CSS styles from a.css and b.css.

krasimir commented 10 years ago

Let me know if that doesn't work.

raphaelgoetter commented 10 years ago

Well, each time I place Techy.js directly in my main project folder, something weird happens : when I run the techycommand, ... it opens the Techy.js file in my sublime text editor and doesn't lanch the techy app ! :/

krasimir commented 10 years ago

Ha ... this is strange.Ok, let me provide another possible name for the file. It looks like that it is not a good idea to be with the same name as the command.

krasimir commented 10 years ago

Ok. Can you please update the Techy version. It should be the latest 0.0.22. Now instead of Techy.js you could use TechyFile.js.

raphaelgoetter commented 10 years ago

Hi.

It works now with the new config file name.

But the "watch" funtion seems not not to work : even if "Techy is listening for changes", the /css/styles.css compiles only when I do a techy command; it's not automatic when I change the CSS

krasimir commented 10 years ago

Good catch, thanks. It's because by default Techy is listening for .js files to fire CSS compilation. I'll add the glob pattern used in the TechyFile.js to the Gulp's watch method. Will do that probably in the next hour.

krasimir commented 10 years ago

By the way if you plan to use Techy you may be interested in this http://krasimir.github.io/techy/docs/#using-yaml-front-matter

krasimir commented 10 years ago

A new version 0.0.25 is released. It contains the fix for the missing watch.

raphaelgoetter commented 10 years ago

And works ! Thank you :)

raphaelgoetter commented 10 years ago

Oh euh now it's my .md pages (in project folder - or anywhere else) that seems not watched anymore (not automatically compiled in html)

krasimir commented 10 years ago

Can you please let me know your file structure. If possible send me your files to info(at)krasimirtsonev.com. The following code is responsible for watching .md files and it should work.

gulp.watch([root + '/**/*.md'], function(event) {
    this.compilePage(event.path);
}.bind(this));

P.S. what is your OS?

krasimir commented 10 years ago

By the way, there is a problem of Gulp's watcher. Once it is started it doesn't recognize the newly created files. I.e. when you start Techy and you add a new file it is not watched for changes. You need to restart the Techy. Or that's how it works under Windows7.

krasimir commented 10 years ago

I read a bit and found this https://github.com/gulpjs/gulp/issues/269 It looks that we are all waiting for an update of Gulp in order to make the watcher sees new files.

raphaelgoetter commented 10 years ago

OK, let's wait then :)

raphaelgoetter commented 10 years ago

BTW my OS is Win8.1

krasimir commented 10 years ago

Thannks. Actually, are your markdowns properly watched if they are not created after the Techy's launch. I mean those which are on the disk when run the command.

raphaelgoetter commented 10 years ago

Yes they are (in every folders) :)

ismay commented 10 years ago

Confirmed on windows 7 (32 bit) as well. .css files are properly watched and concatenated, .md files too.

Only .md files that were created after running the techy command are not picked up by the watch task. For that I too have to run the command again.