Closed juanvisbal closed 9 years ago
Hey in Meteor there is a build plugin which will be used on build time. See: http://docs.meteor.com/#/full/Package-registerBuildPlugin
I don't know exactly what you want to achieve but you shouldn't use require on the client and on the server it should be stylus = Npm.require('stylus')
(you can also read about npm package: https://meteorhacks.com/complete-npm-integration-for-meteor)
Anyway I don't think that Stylus will work with Meteor this way. You probably should try to build your own build plugin
based on this one: https://github.com/juliancwirko/meteor-s-grid/blob/master/plugin/compile-stylus.js and create your own Stylus package like s-grid.
I define my grid like this
.grid
grid()
.box
cells(1, @cols)
Where @cols is a random number from a javascript variable. If I use a generic number or generate the random number with Stylus it works fine, but i need the JS variable (i use it for other things).
In this case you should probably write your own build plugin. For now in Meteor all Stylus compilation is done through build plugin. You can't do this partially. Here is some more info: https://github.com/meteor/meteor/wiki/CompileStep-API-for-Build-Plugin-Source-Handlers
I'm trying to create the columns variable in Javascript (Coffeescript really) and access them in Stylus but so far I'm getting error
require not defined
.My coffee file is in the lib folder and my main.styl file in the client folder.
I get this error
The pure Stylus grid works fine but i can't seem to be able to set the columns through Javascript. I need the column value outside of .styl and this is the only way i figure out how (don't know how to make it in .styl and access it in JS).