Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Integrate preprocessor triggers #2

Open
liambrownweb opened this issue Feb 22, 2017 · 3 comments
Open

Integrate preprocessor triggers #2

liambrownweb opened this issue Feb 22, 2017 · 3 comments

Comments

@liambrownweb
Copy link

Toying with an idea, let me know what you think.

Currently I'm using Stylus, node-watch, and electron-css-reload in conjunction with a Node script I built to automate (p)reprocessing and reloading of stylesheets. The results: my colleagues and I have an easily managed hierarchy of Stylus scripts, we keep our hands clean from any raw CSS, and our process for style changes is actually better than using the built-in development tools in Chromium. I'm thinking it might make sense to fold the external functionality into this module; in addition to watching a file and its dependencies for changes to trigger an incremental reload, it could call the external preprocessor to rebuild the stylesheets. Stylus was my first choice, but I think it would be practical to avoid tight coupling and encourage the development of interfaces for other preprocessors too.

I realize this may represent unwanted scope-creep, but if you like it, I can prototype an integration on my separate project and submit a PR once I've verified a working state in my dev environments.

@dperrymorrow
Copy link
Owner

yeah i have toyed with the idea as well, I use stylus as well, but i feel that if we went down this route, we would have to support all the preprocessors less, stylus, scss ect...

my workflow is just having a npm script to compile stylus on change, and I like how simple that is rather than using another build tool

these are my typical npm scripts for a given electron project

scripts": {
    "stylus": "node_modules/stylus/bin/stylus --include-css -w frontend/windows/**/*.styl -I node_modules",
    "start:dev": "NODE_ENV=development electron .",
    "start:prod": "NODE_ENV=production electron .",
    "watch": "onchange './**/*.js' './**/*.html' './**/*.json' -i -- npm run start:dev"
  }

@liambrownweb
Copy link
Author

liambrownweb commented Feb 23, 2017 via email

@dperrymorrow
Copy link
Owner

yeah, i want to change the way this work which would play into that suggestion. Currently the DOM is scraped for css links and then those files are watched, this is not great for two reasons,

  • its overly complicated, why not just pass in the dir of your css to watch
  • it does not automatically detect dependancies of that linked css file changing, thus the hacky data-source="" workaround

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants