coderaiser / join-io

join files on a fly to reduce requests count

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Stylus issue with Express

azappa opened this issue · comments

Using join-io in an Express project with livecompile of *.styl files everytime server starts build a compressed css without new edits: for view edits in my *.styl files (built into css files) I need to view in a new browser tab the css compiled file (eg: command+t on Chrome, view localhost:3000/css/style.css) and refresh window.

My piece of code where are server settings:

app
  .use(
    stylus.middleware({ 
      src: path.join(__dirname, 'public'), 
      compile: function (str, path) { 
        return stylus(str)
                .set('filename', path)
                .set('compress', true)
                .use(nib());
      } 
    })
  )
  .use(favicon(__dirname + '/public/img/favicon.png'))
  .use(logger('dev'))
  .use(bodyParser.urlencoded({ extended: true }))
  .use(bodyParser.json())
  .use(methodOverride())
  .use(cookieParser('xxx'))
  .use(
    session({
      secret: 'xxx',
      saveUninitialized: true,
      resave: true
    })
  )
  .use(express.static(path.join(__dirname, 'public')))
  .use( joinio({ dir: path.join(__dirname, 'public'), prefix: '/join', minify: true }) )
  .use(errorHandler());

and my jade template css linking

link(rel='stylesheet', href='/join:/font/font_icons8.css:/css/style.css:/css/mobile.css')

Is there a sort of cache or anything related to it?

Thank you!

join-io uses minify for minification when you set flag minify: true. CSS files minify every time they changed. Tomas used for saving results in tmp directory.

Is there some problem with cache?

I'm monitoring app with nodemon, so everytime I change something in a *.styl file it restarts (and theorically building *.styl files into *.css)

"scripts": {
    "start": "node app.js",
    "dev": "./node_modules/.bin/nodemon -e js,styl,jade app.js"
  },

But join won't refresh them anymore (like I said before I have to see compiled .css file into a new tab and refresh the site to see the changes).
In my app I compile css files into the same directory of .styl ones and I didn't set any type of cache...

For the moment I'm using join-io only for js files into one req.

You could try to set minify: false no cache should be produced in this case.

Closed due to long time of inactivity.