Monaca Onsen UI Discord Chat Github Repo

onsenui and git



  • Hi to all.
    i’m trying to use onsenui with it’s build tools using theme.css in a cordove application.

    i’m able to build and use the built css in the application, but as default, the whole node_modules is ignored by git and the theme source code is inside the node_modules.

    Any idea ? I don’t need to put the compiled css under git (it’s built every time), but i have to put the the theme source under git.

    I’ve tried to install the onesenui module in a custom folder without using the node_modules, without success (every time, a node_modules dir is created)


  • administrators

    Sorry, I’m not sure I understand what you’re doing. Are you making custom modifications to theme.css or something?

    It is correct that node_modules should be ignored by git. You should always be able to recreate node_modules from your package.json by running npm install, so there is no need for git to track node_modules. If you are editing files in node_modules, there is probably a better way to do it.



  • I would like to customize the theme.css file but it’s located inside node_modules and as you correctly wrote , touching files inside that directory is not good

    So, how to create a custom theme in a different directory?


  • administrators

    Have you tried Theme Roller? https://onsen.io/theme-roller/?customize



  • @emccorson yes, but i dont want a pre-built file


  • administrators

    If you want to customise some of the Onsen CSS rules, use Theme Roller to change what you want then download the file and add it to your source directory.

    If you don’t want to do that, you should make your own CSS file with your own rules and make it take precedence over the Onsen rules. You can make your own CSS classes or just add rules for the existing Onsen classes. As long as you make sure your custom rules take precedence.

    Basically, you don’t want to be editing theme.css directly



  • @emccorson said in onsenui and git:

    If you don’t want to do that, you should make your own CSS file with your own rules and make it take precedence over the Onsen rules. You can make your own CSS classes or just add rules for the existing Onsen classes. As long as you make sure your custom rules take precedence.

    Basically, you don’t want to be editing theme.css directly

    How can i create a brand new theme and build it autonatically the css like with the stock one?


  • administrators

    Create a new file that contains your CSS rules and link it in the head of your index.html file. The same way as the Onsen UI CSS files are linked. (I’m assuming you are not using a bundler or anything.)

    That way you can add all your CSS rules to the file manually. I still think it would be easier to use Theme Roller to create your rules though.



  • @emccorson said in onsenui and git:

    Create a new file that contains your CSS rules and link it in the head of your index.html file. The same way as the Onsen UI CSS files are linked. (I’m assuming you are not using a bundler or anything.)

    That way you can add all your CSS rules to the file manually. I still think it would be easier to use Theme Roller to create your rules though.

    This doens’t allow me to use cssnext syntax as stock onsen does.


  • administrators

    @gandalf cssnext compiles to CSS right? So as part of your build process, you need to generate a CSS file from your custom rules written in cssnext and link it.