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

add back support for browserify and webpack #32

Merged
merged 1 commit into from Feb 3, 2017
Merged

add back support for browserify and webpack #32

merged 1 commit into from Feb 3, 2017

Conversation

philschatz
Copy link
Contributor

@philschatz philschatz commented Feb 1, 2017

Thanks for a great repository!

I'm using it at philschatz/css-plus to implement some features in https://www.w3.org/TR/css-content-3/ and https://www.w3.org/TR/css-gcpm-3/ but noticed there is a file missing when building for the browser.

I'm not sure but it seems this could fix it.

@coveralls
Copy link

coveralls commented Feb 1, 2017

Coverage Status

Coverage remained the same at 98.302% when pulling 35692a1 on philschatz:fix-browserify-webpack into 2b2d88b on csstree:master.

@lahmatiy
Copy link
Member

lahmatiy commented Feb 1, 2017

Thanks!

Could you explain what is the problem? How do you use it?
I'm not sure default-syntax.json is needed now, since it includes into csstree.js.

@philschatz
Copy link
Contributor Author

Ah, I forgot to include a console error:

$ browserify src/index.js
Error: module not found: "../../data" from file (...)/css-plus/node_modules/css-tree/lib/syntax/default.js

I think this is because of the "browser" section in package.json.

I updated the Pull Request to reflect that 😄

@coveralls
Copy link

coveralls commented Feb 1, 2017

Coverage Status

Coverage remained the same at 98.302% when pulling e358777 on philschatz:fix-browserify-webpack into 2b2d88b on csstree:master.

@lahmatiy
Copy link
Member

lahmatiy commented Feb 1, 2017

Thank you for details.
Do you want to build csstree by yourself? In this case use npm run build.
Or you require it from lib and try to browserify another script?

@lahmatiy
Copy link
Member

lahmatiy commented Feb 1, 2017

We need browser section in package.json, since all content of mdn-data-*.json files will be included in csstree build. But those files contain too much information that we don't want to have in dist file.

@philschatz
Copy link
Contributor Author

philschatz commented Feb 1, 2017

I am using css-tree in css-plus (running in NodeJS and a Browser) to parse a file with CSS syntax but I do not need any of the items listed in https://csstree.github.io/docs/syntax.html so I am not sure if that helps answer your question.

An example "CSS" that I would like to parse:

.chapter::after(1)::before(1) { content: "Homework Problems"; }
.chapter::after(1) { 
  class-add: "homework-problems";
  content: move-here('.exercise'); 
}

css-plus then uses that to manipulate an HTML file instead of using XSLT (because it is easier to write CSS than XSLT). The example above creates a new element at the end of a .chapter, adds a title, and moves all the .exercise elements into it.

Removing the "browser" section in package.json worked for me (see Example JSFiddle ) but if there is a way to only include the parser that would be wonderful since it would reduce the resulting file size.

@lahmatiy
Copy link
Member

lahmatiy commented Feb 2, 2017

Ok, now it's clear to me. Your initial change (with .npmignore) were correct then. Revert to it please.
Until new version is published you mat generate this file by npm run gen:syntax or create a file by yourself.

@lahmatiy
Copy link
Member

lahmatiy commented Feb 2, 2017

@philschatz I'm preparing for new release soon. Could you please revert your changes to initial state? I would like to merge it.

@philschatz
Copy link
Contributor Author

ok, I removed the extra commit. Thanks for the feedback!

@lahmatiy lahmatiy merged commit ef267cc into csstree:master Feb 3, 2017
@philschatz philschatz deleted the fix-browserify-webpack branch February 17, 2017 17:56
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

Successfully merging this pull request may close these issues.

None yet

3 participants