foundation / panini

A super simple flat file generator.
Other
592 stars 104 forks source link

Having trouble with standalone Panini directions: CLI says 'command not found' #172

Closed aalokt89 closed 4 years ago

aalokt89 commented 5 years ago

I love the power of panini, but I want to use it without the Zurb stack. I'm trying to set up my project but the documentation is very thin and not detailed for beginners (I'm admittedly a beginner with gulp). Is there a detailed guide or simple example project example anywhere?

Steps I've taken so far:

  1. npm init
  2. npm install panini --save-dev
  3. npm install gulp --save-dev
  4. (?) Manually created the proper file structure (src/pages, layouts, partials, data, components assets | dist) (?)
  5. Created a new gulpfile.js and copied the snippet from github:
    
    var gulp = require('gulp');
    var panini = require('panini');

gulp.task('default', function() { gulp.src('pages/*/.html') .pipe(panini({ root: 'pages/', layouts: 'layouts/', partials: 'partials/', helpers: 'helpers/', data: 'data/' })) .pipe(gulp.dest('build')); });

gulp.watch(['./src/{layouts,partials,helpers,data}/*/'], [panini.refresh]);


Now I'm not really sure what to do. I also tried via the CLI with `panini --root=src/pages --layouts=src/layouts --partials=src/partials --data=src/data --output=dist 'src/pages/**/*.html` but I get a 'command not found' error. Any help would be much appreciated! 
marvinhuebner commented 5 years ago

If you want to use panini via cli you have to install it globally, start it via npm script or via npx.

You can install panini globally via npm install -g panini, then you can simply use panini in the cli.

Via an npm script it works as follows. You have to add a command panini in the scripts section of package.json.

{
  "scripts": {
    "panini": "panini"
  },
  "devDependencies": {
    "panini": "^1.3.0"
  }
}

Then you can use it the following way: npm run panini -- --root=src/pages --layouts=src/layouts --partials=src/partials --data=src/data --output=dist

And from npm version 5.2 you can simply run npx panini --root=src/pages --layouts=src/layouts --partials=src/partials --data=src/data --output=dist.

This should fix your Command not found error.


Without seeing the whole project it is difficult to find the mistake with gulp.

DanielRuf commented 4 years ago

Closing as stale.