Skip to content

Commit 5cfb12a

Browse files
committed
synthesis-file -> synthesis-assets
1 parent 5197dde commit 5cfb12a

13 files changed

Lines changed: 204 additions & 43 deletions

File tree

‎.gitignore‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.DS_Store
2+
npm-debug.log

‎README.md‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ Install synthesis
3636

3737
```sh
3838
meteor add mwc:synthesis #compiles html files
39-
# synthesis-file is optional. If you want to handle relative file paths.
40-
meteor add mwc:synthesis-file #compiles asset files for <img src="image.png"> to work.
39+
# synthesis-assets is optional. If you want to handle relative asset paths.
40+
meteor add mwc:synthesis-assets #compiles assets for <img src="image.png"> to work.
4141
```
4242

4343
synthesis is a meteor 1.3+ package. for 1.2 support use [mwc:compiler](https://github.com/meteorwebcomponents/compiler)
@@ -231,8 +231,8 @@ works inside html.
231231
<any-element src="[[image]]"><any-element> <!--Does not work!! if you want this to work use image = path/from/root/to/image.png -->
232232
<any-element src="{{image}}"><any-element> <!--Does not work!! if you want this to work use image = path/from/root/to/image.png -->
233233

234-
<!-- files in public/ folder -->
235-
<any-element src="/sample-image.png"><any-element> <!--Works!! file should be in public folder src = /sample-image.png -->
234+
<!-- assets in public/ folder -->
235+
<any-element src="/sample-image.png"><any-element> <!--Works!! asset should be in public folder src = /sample-image.png -->
236236

237237
```
238238
works inside css also.
@@ -247,10 +247,10 @@ property: url(var(--url-var)); /* Does not work unless --url-var = absolute path
247247
--url-var = url(path/to/url);
248248
property: var(--url-var);
249249
*/
250-
property: url(/path/to/image.png); /* Works!!. if file is in public folder */
250+
property: url(/path/to/image.png); /* Works!!. if asset is in public folder */
251251
```
252252

253-
File types we supports https://github.com/meteorwebcomponents/synthesis/blob/master/packages/synthesis-file/plugin/synthesis-file.js#L19.
253+
File types we supports https://github.com/meteorwebcomponents/synthesis/blob/master/packages/synthesis-assets/plugin/synthesis-assets.js#L19.
254254

255255
Feel free to add pr's if you want to supports more file types.
256256

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ meteor@1.6.0
1212
minifier-js@1.2.14
1313
modules@0.7.7
1414
modules-runtime@0.7.7
15-
mwc:synthesis-file@0.1.4
15+
mwc:synthesis-assets@0.1.5
1616
promise@0.8.8
1717
random@1.0.10
1818
spacebars-compiler@1.0.13
Lines changed: 61 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
# Synthesis is meteor + polymer
22
[![Gitter](https://badges.gitter.im/Join Chat.svg)](https://gitter.im/aruntk/meteorwebcomponents?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
33

4+
[![Donate](https://dantheman827.github.io/images/donate-button.svg)](https://www.paypal.me/arunkumartk)
5+
46
## About
57

68
Synthesis helps you use polymer inside meteor.
@@ -32,7 +34,11 @@ Remove `blaze-html-templates` (or remove the html compiler you are using).
3234
3335
Install synthesis
3436

35-
`meteor add mwc:synthesis`
37+
```sh
38+
meteor add mwc:synthesis #compiles html files
39+
# synthesis-assets is optional. If you want to handle relative asset paths.
40+
meteor add mwc:synthesis-assets #compiles assets for <img src="image.png"> to work.
41+
```
3642

3743
synthesis is a meteor 1.3+ package. for 1.2 support use [mwc:compiler](https://github.com/meteorwebcomponents/compiler)
3844

@@ -42,6 +48,7 @@ You can optionally use these packages from meteorwebcomponents
4248
* [mwc:router](https://github.com/meteorwebcomponents/router) - Flowrouter with polymer.
4349
* [mwc:layout](https://github.com/meteorwebcomponents/layout) - Polymer layout renderer.
4450

51+
4552
## Usage
4653

4754
### Polymer Settings
@@ -71,7 +78,9 @@ You can import html using
7178

7279
2. `<link rel="import" href="./component.html"> `from html files
7380

74-
> Please note that `import 'package/package.html;'` imports from node_modules directory while `<link rel="import" href="package/package.html">` is the same as `import "./package/package.html";`. This is kept like this to go through polymer components in which dependency files inside the same folder are imported as `<link rel="import" href="dependency.html">`
81+
> Please note that `import 'package/package.html;'` imports from node_modules directory while `<link rel="import" href="package/package.html">` is the same as `import "./package/package.html";`. This is kept like this to go through polymer components in which dependency files inside the same folder are imported as `<link rel="import" href="dependency.html">`.
82+
83+
> If you want to import scripts/stylesheets/html from public use `src="/path/to/my/file"`. `src="path/to/my/file"` is interpreted as `import "./path/to/my/file"`.
7584
7685
Script
7786

@@ -209,6 +218,44 @@ import "@polymer/paper-button/paper-button.html";
209218
```
210219
>Please note that the @polymer packages are still in testing stage. And the polymer version is an older one.
211220
221+
### Assets
222+
223+
works inside html.
224+
225+
```html
226+
<!-- imports/ui/path/to/element.html -->
227+
<img src="sample-image.png"> <!--Works!!-->
228+
<iron-image src="sample-image.png"><iron-image> <!--Works!!-->
229+
<any-element src="sample-image.png"><any-element> <!--Works!! src = imports/ui/path/to/sample-image.png -->
230+
<any-element src="../sample-image.png"><any-element> <!--Works!! src = imports/ui/path/sample-image.png-->
231+
<any-element src="[[image]]"><any-element> <!--Does not work!! if you want this to work use image = path/from/root/to/image.png -->
232+
<any-element src="{{image}}"><any-element> <!--Does not work!! if you want this to work use image = path/from/root/to/image.png -->
233+
234+
<!-- assets in public/ folder -->
235+
<any-element src="/sample-image.png"><any-element> <!--Works!! asset should be in public folder src = /sample-image.png -->
236+
237+
```
238+
works inside css also.
239+
240+
```css
241+
242+
/*imports/ui/path/to/element.html inside style tag or imports/ui/path/to/element.css */
243+
background: url(path/to/image.png); /* Works!!. */
244+
property: url(relative/path/to/image.png); /* Works!!. */
245+
property: url(var(--url-var)); /* Does not work unless --url-var = absolute path imports/ui/path/to/image.png */
246+
/* if you want to use variables use
247+
--url-var = url(path/to/url);
248+
property: var(--url-var);
249+
*/
250+
property: url(/path/to/image.png); /* Works!!. if asset is in public folder */
251+
```
252+
253+
File types we supports https://github.com/meteorwebcomponents/synthesis/blob/master/packages/synthesis-assets/plugin/synthesis-assets.js#L19.
254+
255+
Feel free to add pr's if you want to supports more file types.
256+
257+
Relevant code https://github.com/meteorwebcomponents/synthesis/blob/master/packages/synthesis-compiler/synthesis-compiler.js#L166-L176 .
258+
212259
### Demo
213260

214261
#####Using Bower
@@ -220,10 +267,19 @@ Check out the [Synthesis Demo](https://github.com/meteorwebcomponents/synthesis-
220267
Check out the [synthesis-meteor-polymer-npm-demo](https://github.com/meteorwebcomponents/synthesis-meteor-polymer-npm-demo)
221268

222269
### Kickstart Your Meteor Polymer projects
223-
[Kickstart a Meteor/Polymer project](https://github.com/aruntk/kickstart-meteor-polymer) with Synthesis.
270+
[Kickstart a Meteor/Polymer project - FlowRouter](https://github.com/aruntk/kickstart-meteor-polymer) with Synthesis.
271+
272+
[KickStart Meteor/Polymer Project - Polymer App Route](https://github.com/aruntk/kickstart-meteor-polymer-with-app-route)
224273

225274
![synthesis1](https://cloud.githubusercontent.com/assets/6007432/14216652/9da7131a-f867-11e5-9f84-6dd75d60dd45.gif)
226275

276+
### Like it?
277+
278+
:star: this repo
279+
280+
### Found a bug?
281+
282+
Raise an issue!
227283

228284
### TODO
229285

@@ -255,7 +311,7 @@ Try to find out which package contains large number of js files. Delete unecessa
255311

256312
Q: Is it possible to use npm instead of bower for loading polymer and components
257313

258-
Ans : Yes there is. Refer [using polymer instead of bower](#using-polymer-from-npm-instead-of-bower)
314+
Ans : Yes there is. Refer [using npm instead of bower](#using-polymer-from-npm-instead-of-bower)
259315

260316
Q: Can I use Polymer and blaze together?
261317

@@ -267,4 +323,4 @@ But there are some compatibility issues https://forums.meteor.com/t/polymer-mete
267323

268324
Q: I love blaze's template level subscriptions and spacebars. I dont want to lose these features when I port my app to polymer. Any help?
269325

270-
Ans : In my experience I find nothing that polymer cannot do which blaze can. Polymer is very easy to learn and while porting your app you'll find yourself copy pasting most of your code. For every blaze function they have solutions in polymer. We have got you covered when it comed to meteor data and subscriptions (including template level subs) Refer [mixin](https://github.com/meteorwebcomponents/mixin) .
326+
Ans : In my experience I find nothing that polymer cannot do which blaze can. Polymer is very easy to learn and while porting your app you'll find yourself copy pasting most of your code. For every blaze function they have solutions in polymer. We have got you covered when it comes to meteor data and subscriptions (including template level subs) Refer [mixin](https://github.com/meteorwebcomponents/mixin) .
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Package.describe({
2-
name: 'mwc:synthesis-file',
3-
version: '0.1.4',
4-
summary: 'file handling for synthesis',
2+
name: 'mwc:synthesis-assets',
3+
version: '0.1.5',
4+
summary: 'assets handling for synthesis',
55
git: 'https://github.com/meteorwebcomponents/synthesis',
66
documentation: 'README.md',
77
});
@@ -13,12 +13,12 @@ Package.onUse((api) => {
1313
});
1414

1515
Package.registerBuildPlugin({
16-
name: 'synthesis-file',
16+
name: 'synthesis-assets',
1717
use: [
1818
'caching-html-compiler@1.0.7',
1919
'ecmascript@0.4.1',
2020
],
2121
sources: [
22-
'plugin/synthesis-file.js',
22+
'plugin/synthesis-assets.js',
2323
],
2424
});
File renamed without changes.

‎packages/synthesis-compiler/.versions‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,15 +23,15 @@ html-tools@1.0.10
2323
htmljs@1.0.10
2424
id-map@1.0.8
2525
jquery@1.11.9
26-
local-test:mwc:synthesis-compiler@1.3.4
26+
local-test:mwc:synthesis-compiler@1.3.5
2727
logging@1.0.14
2828
meteor@1.6.0
2929
minimongo@1.0.17
3030
modules@0.7.7
3131
modules-runtime@0.7.7
3232
mongo@1.1.9_1
3333
mongo-id@1.0.5
34-
mwc:synthesis-compiler@1.3.4
34+
mwc:synthesis-compiler@1.3.5
3535
npm-mongo@1.4.45
3636
observe-sequence@1.0.12
3737
ordered-dict@1.0.8

0 commit comments

Comments
 (0)