This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'rubygems' | |
require 'bundler' | |
Bundler.require | |
require './application' | |
namespace :assets do | |
desc 'compile assets' | |
task :compile => [:compile_js, :compile_css] do | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# You could do it before, after save or in any place you want | |
before_save do | |
# build i file if you want to check something with it first | |
file = @api.file(self."#{file_attribute}") | |
if file.something ... | |
url = file.cdn_url | |
end | |
# or use bare url widget passed to you from web form | |
url = self."#{file_attribute}" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# You could do it before, after save or in any place you want | |
before_save do | |
file = self.file #or group, or that ever your attribute is called | |
# it is important to wrap it up in case remote call fails for any reason | |
begin | |
response = file.copy true, "#{target}" | |
# { | |
# "url" : "http://..." | |
# } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const background = require('./assets/background.png') | |
// ... | |
{ | |
//... | |
render: function() { | |
return ( | |
<div> | |
<img src={background} /> | |
<img src={background + '-/resize/600x/-/blur/10/-/mirror/-/format/jpg/-/quality/best/-/progressive/yes/'}> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// background.styl | |
.background | |
background-image: url('./assets/background.png') | |
.smallFlipedAndBluredBackground | |
background-image: url('./assets/img.jpg?operations=/-/resize/600x/-/blur/10/-/mirror/-/format/jpg/-/quality/best/-/progressive/yes/') | |
// CSS bundle output: | |
// => .background { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loaders: [ | |
{test: /\.(jpg|png|gif|otf|ttf|eot|mp4|webm)$/, loader: 'file?name=[name]@[hash].[ext]'}, | |
] | |
// require('./assets/background.jpg') | |
// | |
// => "/_assets/[email protected]" or something like this. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
loaders: [ | |
{ | |
test: /\.(jpg|png|gif|otf|ttf|eot|mp4|webm)(\?.*)?$/, // this ugly thing here for operations query support | |
loader: 'uploadcare', | |
query: { | |
publicKey: 'demopublickey', | |
privateKey: 'demoprivatekey', | |
statsFilePath: path.join(__dirname, 'build', 'uploadcare.json'), | |
resourcePathDivider: 'app', | |
}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
"extends": ["airbnb", "plugin:import/errors"], | |
"plugins": [ | |
"react", | |
"import", | |
], | |
"parserOptions": { | |
"ecmaVersion": 6, | |
"sourceType": "module", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as firebase from 'firebase/firebase-node' | |
export default function importFirebase() { | |
return Promise.resolve(firebase) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default function importFirebase() { | |
// dynamic import, will return promise | |
// magic weback comment to get meaningfull chunkname | |
return import(/* webpackChunkName: 'firebase' */ 'firebase/firebase-browser') | |
} |
OlderNewer