Comments (4)
Yeah, the current /dist folder only has the bundled files as you mention, and there is no CommonJS format for each individual source file. This is an artifact of how I currently develop the library, which is just to use the AMD files in the /samsara directory. When we move to an es6 format this will no longer be the case, and you'll be able to import individual files and do tree shaking.
from samsara.
@dmvaldman The only thing you have to do to support this is to simply publish the the /samsara
folder to NPM too.
Any modern bundler like Webpack, JSPM, Browserify, understands AMD format.
@chickendinosaur, after @dmvaldman makes that small change, you can just import the specific files that you want after making an alias to the /samsara
folder.
In Webpack, the resolve.alias
property can be used to define an alias like samsara: samsara/samsara'
(which means "let anything imported from samsara/
actually beimported from samsara/samsara") then things can be imported like
import RenderNode from 'samsara/core/nodes/RenderTreeNode'
Without the alias it would still work, but the import would need to be
import RenderNode from 'samsara/samsara/core/nodes/RenderTreeNode'
Some libs put stuff in src
, so the alias in that case would be some-lib: some-lib/src'
in order to avoid having to put src/
in every import path.
from samsara.
@dmvaldman @chickendinosaur Oops, I was looking at https://www.npmjs.com/package/samsara, not https://www.npmjs.com/package/samsarajs.
samsarajs
on NPM already includes the /samsara
folder, so you're good to go!
@chickendinosaur You can import any file just as they are, right now, in Webpack. They don't need to be in ES6 format.
In AMD format there may not be tree shaking by Webpack, though it is not strictly impossible because there's nothing inherent about AMD that prevents a bundler from statically analyzing functions to see which are used or not, but, at least you can import stuff.
from samsara.
@dmvaldman You can possibly close this one, since the files are importable already with standard bundlers, and prefer #18 in case you want to migrate to that format in the future. (Safari tech preview already has ES6 module loader, so it can load ES6 modules at runtime without any build tools!)
from samsara.
Related Issues (20)
- Not responsive to split view on iOS HOT 4
- [Question] Min & Max Opacity HOT 8
- EventEmitter incorrectly binds owner on `once`
- EventHandler never turns off upstream events HOT 1
- [Question] will-change size HOT 2
- [Question] How to populate the div within a Surface using Javascript HOT 8
- React Native HOT 3
- Manipulating StyleSheets instead of inline styles HOT 4
- Views added to context after context has been mounted need a resize event to be render HOT 2
- Question : Can Samsara leverage the capabilities of shadow-dom ?? HOT 1
- FYI - FastDom HOT 1
- SequentialLayout can't be align to bottom HOT 7
- Scrollview.goTo(x) goes bananas on iOS HOT 6
- Paginated Scrollview can't handle resize/orientation change HOT 1
- Scrollview bug IE11
- set/toggle/remove classes bug
- Awesome work HOT 2
- Non-nested CSS3D seems to be getting bad in Chrome. HOT 5
- Is Samsara viable when implementing animations designed in Framer? HOT 1
- misalignment with Cube demo HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from samsara.